-1

I am getting some data from a website using it's API which is in JSON format. The code required is here -

{
    "response": {
        "success": 1,
        "current_time": 1391942785,
        "prices": {
           "5021": {
               "6": {
                "0": {
                    "current": {
                        "currency": "metal",
                        "value": 7,
                        "last_update": 1388772055,
                        "difference": 0.175
                    }
                }
            }
         }
      }
   }
}

Now I want to ask you guys, If I want to parse this and use the part about the value which is 7 at the moment. How can I do that? Just provide me with a sample that will print the value? or open up a messagebox?

1
  • Did you at least try something ? that you may show it to us Commented Feb 9, 2014 at 11:10

1 Answer 1

1

You can use JSON.NET library e.g. :

var obj = JsonConvert.DeserializeObject<JContainer>(jsonText);
var value = (int)obj["response"]["prices"]["5021"]["6"]["0"]["current"]["value"];
// value = 7
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.