我有一个如下所示的JSON文档:
{
"items": [ 'one', 'two', 'three' ]
}
当标准XML_SERIALIZER将其序列化为XML时,它看起来像这样:
<root>
<items>
<item>one</item>
<item>two</item>
<item>three</item>
</items>
</root>
我想将其序列化为以下XML格式:
<root>
<items>
<item>
<value>one<value>
</item>
<item>
<value>two<value>
</item>
<item>
<value>three<value>
</item>
</items>
</root>
这里有人可以帮忙吗?
我当前的XML_SERIALIZER选项如下所示:
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"
答案 0 :(得分:0)
试试这个:
{"items":[{"value":"one"},{"value":"two"}]}