Reputation: 83
jsonUptimeRobotApi({"stat": "ok","account":{"monitorLimit":"50", "monitorInterval":"5", "upMonitors":"23", "downMonitors":"1", "pausedMonitors":"0"}})
Can anybody tell me a way to parse it.
Upvotes: 0
Views: 97
Reputation: 1299
This looks a lot like Flickrs response with their jsonFlickrApi().
Maybe you can read the documentation, you can add this to the Flickr calls to receive a normal JSON &nojsoncallback=1
.
Or if all else fails, you could do something like this:
String jsonResponse = "jsonUptimeRobotApi({"stat": "ok","account":{"monitorLimit":"50", "monitorInterval":"5", "upMonitors":"23", "downMonitors":"1", "pausedMonitors":"0"}})";
int startIndex = jsonResponse.indexOf("(") + 1;
int endIndex = jsonResponse.lastIndexOf(")") - 1;
jsonResponse = jsonResponse.substring(startIndex, endIndex);
JSONObject jo = new JSONObject(jsonResponse);
Again, I would recommend against this approach, but this will probably get you what you want.
Upvotes: 3