akopan / x2js

Automatically exported from code.google.com/p/x2js
0 stars 0 forks source link

Arrays of objects are not handled properly #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When calling json2xml_str()

When you have something like:

{ name: [ { first: 'Dean' } , { first: 'Dan' } ] }

The 'name' is dropped and only 2 <first> nodes are created

Alternatively, I noticed that children arrays were not being parsed in other 
situations, and realzied it was due to line #198

The returned object was coming up blank because the node was 1 level deep. The 
object contained attributes, but it did not know what the node name should be, 
and as such returned an empty string.

So instead I changed the code to:

var item = {};
item[it] = subObj[arIdx];
result+=parseJSONObject(item);

Original issue reported on code.google.com by deansofer on 16 Sep 2012 at 11:41

GoogleCodeExporter commented 9 years ago
Working on it

Original comment by abdulla....@gmail.com on 20 Sep 2012 at 7:28

GoogleCodeExporter commented 9 years ago
Array of objects now is handling like array with primitive types. Can you check 
please fix (v1.0.7)?

Original comment by abdulla....@gmail.com on 20 Sep 2012 at 8:10

GoogleCodeExporter commented 9 years ago

Original comment by abdulla....@gmail.com on 18 Oct 2012 at 9:06