Hello,
I am new to thingspeak.I am trying to Parse the Json values of a channel.I tried for the description and metadata and got it.Now i am trying to get the api_keys but i am unable to do it.I am adding the code that i used to parse.with this below code i am getting the error (Uncaught SyntaxError: Unexpected token [ in JSON at positon 1).Can anyone help me how to Parse JSON api_key values,Thankyou.
CODE:-
var obj,ak ;
ak="";
for (var i=0; i<json.length; i++) {
obj = json[i];
if (obj == null || obj == "") {
window.alert("
The "+(i+1)+"th object is NULL/BLANK.");
} else {
if (obj.id == did) {
if (obj.api_keys == null || obj.api_keys == "") {
window.alert("
The api_keys portion of "+(i+1)+"th object is NULL/BLANK.");
} else {
ak = JSON.parse("{" + obj.api_keys + "}");
console.log("
The deails of "+(i+1)+"th Object are :
Apikey : " + ak.api_key + "
WriteFlag : " + ak.write_flag );
}