0

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?

2
  • 2
    If you don't want to deserialize the Json data you'll need to parse it. Are you sure it's worth the effort? Commented Sep 22, 2010 at 13:34
  • Hi Paolo, If I deserialize the json data, I will get all the data elements which I don't want. I want to fetch only few elements and exclude rest of the thing. In the above example, I have used only few elements, but in actual it has got more data. Please suggest how I can do this. Thanks. Commented Sep 23, 2010 at 4:37

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.