Are inconsistent JSON related errors a regular thing?

Has anyone ever had experiences of their code running fine in a loop for 98% of the time but ever now and then a few errors crop up?

I am retrieving some JSON with my sketch and every now and then the response from the web page gives me the error "Parameter 'id' is expected to be an integer in a specified range." This error is only for an instance as the error is caught and the retrieval loop continues to get the next lot of JSON. One would think the error would be something to do with the parameters in the URL thats used to retrieve the data but as i mentioned above 98% it works fine and nothing has made a change to that variable when it does.

The other error that occasionally pops up and not so often is that when trying to parse some JSON i get the error 'A JSONObject text must begin with '{' '. Pretty self explanatory you would think but as with the other error it is simply not an issue most of the time so why randomly is it not finding JSON at that URL for a split second? Every time i check manually there is always available JSON, just seems like its doing it to annoy me lol!

The errors are not a big problem as i get around them easily enough with try catch, just am curious to know if others have had similar experiences? thanks.

Tagged:

Answers

  • sounds like you are reading the json file before it's complete

    but without seeing the code we are just guessing...

  • The JSON file itself is external though, is it possible at the time processing makes the cal the external JSON is going through some sort of change and then a split second later its all back to normal?

    I will see if i can pop some code up later.

Sign In or Register to comment.