{"status":1,"msg":"Success","details":{"123456789":{"id":"4029292","name":"ram"}}}
This is my string (I think json array not sure). I got this as response from webservice.
How do I get elements from this?
{"status":1,"msg":"Success","details":{"123456789":{"id":"4029292","name":"ram"}}}
This is my string (I think json array not sure). I got this as response from webservice.
How do I get elements from this?
If you are trying to parse it in C#, try using newtonsoft json.net for parsing json response.
It is simple and easy
Following are some references
Take a look at the Json.Net library.
You can use it to deserialize json in both c# and javascript.
Message deserializedProduct = JsonConvert.DeserializeObject<Message>(json);
The Message class would have to map to response you are getting.
Below is my code to append a json response to the listview.It may be a good example. Also try this (Javascript):
data.msg[key] or
data.msg.123456789.id
$.each(data.response, function(key, value) {
html += '<li><a class=contact href="#" id="' + data.response[key].id + '" ><h1>' + data.response[key].label + '</h1><p>'+ data.response[key].customerName + '</p><p>' + data.response[key].phone + ', ' + data.response[key].email + '</p></a></li>';
$('#ul_id').append($(html));
html='';
console.log('conatct');
});