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
asked Jul 30, 2016 at 13:31
Karthik
1,2312 gold badges16 silver badges29 bronze badges
-
5You need to print? Do it, what's the problem?nicael– nicael2016年07月30日 13:32:13 +00:00Commented Jul 30, 2016 at 13:32
2 Answers 2
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);
});
answered Jul 30, 2016 at 13:41
Bunny Joel
1715 silver badges16 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
If you want to loop through the properties of the object you can use the keys method that returns the properties of the object and access the object propertywith the dot notation or the [] notation.
answered Jul 30, 2016 at 13:43
Computerlucaworld
3871 gold badge2 silver badges14 bronze badges
Comments
lang-js