I have a JSON object that is returned in different ways, but always has key
. How can I get it?
E.g.
\"Records\": {
\"key\": \"112\"
I will not write the code for you but give you an idea may be it will help, First convert JSON object in to string using
JSON.stringify(obj);
after that search for Key using indexOf() method. Extract previous '{' and Next '}' string and again cast in to JSON object. using
var obj = JSON.parse(string);
Then
var value = obj.key