0

I'm using p5js to load JSON from the instagram API, however when I try loading the JSON I get a 'unexpected token ":"' error on the first colon in the json object

{"more_available": true, "status": "ok" }

that first ':' after 'more_available' triggers the error, and that's not the whole json object, it's way too big, and my only problem is with the first colon

here's my code

function setup() {
createCanvas(windowWidth, windowHeight);
  loadJSON(`https://www.instagram.com/instagram/media/`, loadedData, errLoadingData, 'jsonp');
  // console.log(jsonData);
}

function loadedData(data){
  console.log(data);

}

function errLoadingData(err){

}

and the error

Uncaught SyntaxError: Unexpected token :
de_veloper
  • 11
  • 1
  • 3
    can you add code with your **loadJSON** function? Problem may reside there – shershen Dec 24 '16 at 12:18
  • 3
    There's not enough information provided in your question to diagnose your issue. You've shown a snippet of an object that you're trying to load as `jsonp`... JSONP requires your response data be wrapped in a callback. Was it? – André Dion Dec 24 '16 at 12:19
  • 2
    You need to provide a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). Yours is neither minimal there's a `draw` function as well as as `createCanvas` call which are irrelevant, nor complete (you need to provide the `loadJSON` function, or point to where it comes from) or verifiable (please provide a jsFiddle or something equivalent). – jcaron Dec 24 '16 at 12:28
  • loadJSON is part of p5.js. and I've added the whole JSON object to the post – de_veloper Dec 24 '16 at 13:03
  • Here's the reference for loadJSON in p5.js. https://p5js.org/reference/#/p5/loadJSON. and I tried adding the full json object, it goes over the 30k char limit. It should just be loading from the URL in loadJSON function itself – de_veloper Dec 24 '16 at 13:06
  • The URL retrieved from the request was 'https://www.instagram.com/instagram/media/?callback=reqwest_1482586283624' but the contents itself I believe weren't wrapped, no. – de_veloper Dec 24 '16 at 13:37

0 Answers0