我有类似下面的JSON数据:
{
"#data": [
{
"nid": "814",
"type": "resource",
"language": "",
"uid": "125",
"status": "1",
"title": "title 1",
"description": "description 1",
"rating": "5",
"picture": ""
},
{
"nid": "814",
"type": "resource",
"language": "",
"uid": "125",
"status": "1",
"title": "title 2",
"description": "description 2",
"rating": "3.5",
"picture": ""
}
]
}
我需要使用以下内容构建XML:
<node title="title 1" type="resource" rating="5">
<description>description 1</description>
</node>
<node title="title 2" type="resource" rating="3.5">
<description>description 2</description>
</node>
我不想反序列化JSON数据,但我只需要获取少量元素并构建XML对象。任何人都可以帮我吗?
答案 0 :(得分:1)
将其反序列化为c#对象,然后xml将其序列化。最简单的方法
答案 1 :(得分:0)
除非你想做一些丑陋的字符串解析,否则你需要对它进行反序列化。