Karthik Karthik - 4 months ago 29
Javascript Question

Split json data from json array in jquery

I'm getting a JsonArray like this, by using urlrequest method in jquery

Object {
code:"INR"
price:"14999"
status:"sucess"
qty:"5"
title:"Moto G Plus, 4th Gen (Black, 32 GB)"
}


Now i need to print, certain jsonarray values, using jquery like this

title - Moto G Plus, 4th Gen (Black, 32 GB)
price - 14999

Answer

If you want print each key and value in your json object use this method. json in the function should be you json object. Key and value is your id and value.

$.each(json, function(key,value){
            alert("output: "+key+" value "+value); 
            });
Comments