Reputation: 35264
I have this json string {"Table" : [{"subject" : "No Records are there to Display"}]}
.
If i receive this data i want to alert NO Records Found
. Any suggestion.
Note: My key field may vary accordingly (ie) here it is Subject
and some more like Details
,Description
.
Upvotes: 0
Views: 188
Reputation: 47685
I'd use jquery or any other library to convert the JSON string into a JS object:
var obj = jQuery.parseJSON('{"Table" : [{"subject" : "No Records are there to Display"}]}');
if (obj.Table[0].subject === "No Records are there to Display") {
alert("NO Records Found");
}
Upvotes: 1