{
- "obj1": "value1",
- "obj2": "value2",
- "obj3": "value3"
+ "memb1": "value1",
+ "memb2": "value2",
+ "memb3": [
+ {"name": "first", "color": "red"},
+ {"name": "second", "color": "green", "arr1": [{"arr1_1": "val1_1"},{"arr1_2": "val1_2", "arr1_2_1": "val1_2_1"}]}
+ ]
}
members = json_reader_list_members (reader);
for (i = 0; i < l; i++)
{
- xmlNewTextChild (xnode, NULL, (const xmlChar *)members[i], (const xmlChar *)zak_utils_json_get_string (reader, members[i]));
+ json_reader_read_member (reader, members[i]);
+ if (json_reader_is_array (reader))
+ {
+ xmlNode *cur;
+ guint a;
+ guint j;
+
+ j = json_reader_count_elements (reader);
+ for (a = 0; a < j; a++)
+ {
+ json_reader_read_element (reader, a);
+ cur = xmlNewNode (NULL, (const xmlChar *)members[i]);
+ zak_utils_json_to_xml (reader, cur);
+ xmlAddChild (xnode, cur);
+ json_reader_end_element (reader);
+ }
+ }
+ else
+ {
+ xmlNewTextChild (xnode, NULL, (const xmlChar *)members[i], (const xmlChar *)json_reader_get_string_value (reader));
+ }
+ json_reader_end_member (reader);
}
g_strfreev (members);
}