node-json2xml
node-json2xml copied to clipboard
A small JSON to XML parser
Hi, i need to convert a json data to xml. the sample code is as below. ``` from json2xml import json2xml from json2xml.utils import readfromurl, readfromstring, readfromjson data = readfromstring(...
may be support $value `Password: { $attributes: { Type: 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest' }, $value: funcs.passwordGenerator(nonce, time, adaptorParameter.providerParameters.password) }, `
Test code: ``` var json2xml = require("json2xml") json2xml({ a: 1, attr: { b: 'a&b' } }, { attributes_key: 'attr' }); ``` Result: `1` Where **a&b** should be: **a&b**
See the docs: https://nodejs.org/api/util.html#util_util_format_format_args > Please note that util.format() is a synchronous method that is mainly intended as a debugging tool. Some input values can have a significant performance overhead...
The script: ``` var o2 = { foo : [1, 2, 3] }; console.log(json2xml(o2 )); ``` produces: ``` 123 ``` Arrays should be mapped to a sequence like: ``` 1...
Is there smth that can parse generated xml back to json with initial structure? e.g.` {name:'1212',attr:{title:2}}` in xml will be `1212` Most xml parsers wil convert it to` {name:'1212',title:'2'}`, but...
I'd like the output string to have 2 or 4 space indentations, is it possible?