node-json2xml icon indicating copy to clipboard operation
node-json2xml copied to clipboard

Array Mapping

Open predic8 opened this issue 10 years ago • 3 comments

The script:

var o2 = {
  foo : [1, 2, 3]
};

console.log(json2xml(o2 ));

produces:

<foo>123</foo>

Arrays should be mapped to a sequence like:

<foo>
  <item>1</item>
  <item>2</item>
  <item>3</item>
</foo>

or

<foo>1 2 3</foo>

predic8 avatar May 19 '14 14:05 predic8

:+1:

ghost avatar Mar 10 '15 13:03 ghost

Behaviour: If a sequential array is provided, convert it into an associated array of ['item': 1, 'item': 2, 'item': 3]

estheban avatar Mar 17 '15 13:03 estheban

I fixed this bug perhaps: https://github.com/estheban/node-json2xml/pull/24

iqianxing avatar Nov 21 '17 12:11 iqianxing