JSON Array serialized to XML in PHP

xianhe82

New Member
I have a JSON document that looks like this:\[code\]{ "items": [ 'one', 'two', 'three' ]} \[/code\]When the standard XML_SERIALIZER serializes this to XML it looks like this:\[code\]<root> <items> <item>one</item> <item>two</item> <item>three</item> </items></root>\[/code\]I would like to serialize this into the following XML format:\[code\]<root> <items> <item> <value>one<value> </item> <item> <value>two<value> </item> <item> <value>three<value> </item> </items></root>\[/code\]Can anyone here help with this? My current XML_SERIALIZER options look like this:\[code\]XML_SERIALIZER_OPTION_XML_DECL_ENABLED => false,XML_SERIALIZER_OPTION_MODE => XML_SERIALIZER_MODE_SIMPLEXML,XML_SERIALIZER_OPTION_INDENT => " ",XML_SERIALIZER_OPTION_LINEBREAKS => "\n",XML_SERIALIZER_OPTION_ROOT_NAME => "root",XML_SERIALIZER_OPTION_DEFAULT_TAG => "item"\[/code\]
 
Back
Top