0

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.

1 Answer 1

1

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");
}
Sign up to request clarification or add additional context in comments.

1 Comment

well the obj.Table is an array of json dictionary. Shouldn't this be as obj.Table[0].subject === "No Records are there to Display" ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.