开发者

How can I generate XML from the JSON Data using c#?

I have the JSON data something like below:

{
    "#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": "" 
        }
    ]
}

I need to build XML out of this something like below:

<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>

I don't want to deserialize开发者_运维问答 the JSON data, but I need to fetch only few elements and build the XML object. Can anyone help me on this?


Deserialize it into a c# object then xml serialize it. Easiest way


You'll need to deserialize it, unless you want to do some ugly string parsing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜