JSON get() trouble
in
Contributed Library Questions
•
2 years ago
Hey all, sorry if this is a dumb question, I am trying to get some JSON data, below is an example of my code, this is running inside a method, reading the data doesnt throw an exception by when I try to retrieve it I get "the method getString(int) in the type JSONArray is not applicable for the arguements (string)" however the data I am trying to get is a string. I thought it was because the first data pair includes string and int values but I have tried running it on the author string value and I get the same thing - I have included an example of the data below. Any help appreciated
o = entries.getJSONObject(i);
parentArray = split(e.getString("parents"), ",");
r.p1 = int("parentArray[1]");
r.p2 = int("parentArray[2]");
r.author = e.getString("author");
String date = e.getString("date");
r. message = e.getString("message");
{
"parents": [
[
"57fa0370d1caf504062b059ca538b305b518ac83",
2160,
7
]
],
"author": "zach gage",
"time": 2196,
"id": "4db2c27263f69561410e01a630a6458db401eff2",
"date": "2011-01-14 20:19:33",
"gravatar": "b089227a1748a2d70cdfc4ef00b325ad",
"space": 7,
"message": "ofxiPhoneVideoGrabber implemented",
"login": "stfj"
},
o = entries.getJSONObject(i);
parentArray = split(e.getString("parents"), ",");
r.p1 = int("parentArray[1]");
r.p2 = int("parentArray[2]");
r.author = e.getString("author");
String date = e.getString("date");
r. message = e.getString("message");
{
"parents": [
[
"57fa0370d1caf504062b059ca538b305b518ac83",
2160,
7
]
],
"author": "zach gage",
"time": 2196,
"id": "4db2c27263f69561410e01a630a6458db401eff2",
"date": "2011-01-14 20:19:33",
"gravatar": "b089227a1748a2d70cdfc4ef00b325ad",
"space": 7,
"message": "ofxiPhoneVideoGrabber implemented",
"login": "stfj"
},
1