"The constructor JSONObject(Object) is not visible" - what does this mean and how do I fix it?
in
Programming Questions
•
4 months ago
I'm desperately trying to get this code to work:
- String baseUrl = "https://api.xively.com/v2/feeds/1240409657";
- String apiKey = "myKoV3FlYlXwViehe0bDrloiz2OaewxXiahTaSEDsKbXqxSv"; // Your api key goes here
- String feedId = "1240409657"; //Pachube feed ID goes here
- String startDate = "2013-06-10T13:56:14.136746Z"; //Date must be formatted ISO 8601
- String endDate = "2013-06-12T12:00:00Z";
- void setup(){
- getData(); //Retrieve feed from Xively
- };
- void draw(){};
- void getData(){
- String request = baseUrl + feedId + ".json?key=" + apiKey + "&start=" + startDate + "&interval=3600&interval_type=discrete"; //request an hourly breakdown
- String result = join(loadStrings(request), "");
- try{
- // Create a new JSON object with our xivelyData feed
- JSONObject xivelyData = new JSONObject(result);
- println(xivelyData.get("location"));
- JSONArray streams = xivelyData.getJSONArray("datastreams");
- println(streams);
- }
- catch(JSONException e){
- println("There was an error parsing the JSONObject");
- }
- };
Please help, I'm desperate!
1