Skip to content

Instantly share code, notes, and snippets.

@Ugarz
Created October 22, 2018 14:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Ugarz/b7e917e0f1be8982026727ea4617c62a to your computer and use it in GitHub Desktop.
Set data in key of value in object with javascript

Set data in key of value in object with javascript

Consider an simple object like so

// Build object
const obj = {}
// Add data to it
obj.data = { $: { 'myAwesomeKey': 'toto' }, _: 'myAwesomeValue' }

// Convert it to xml
const xml = xml2js(objet)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment