The JSON parser I use decodes an entire record at one time, so either the whole JSON record parses correctly or it's rejected. I only showed a text file line-based example because it was easy. If you want to handle a response at a time, it would be essentially the same: Wrap the JSON decode operation in an eval { } block, then check the $@ variable to see if there's an exception after the eval block and choose to process the data or handle the error.
...roboticus
When your only tool is a hammer, all problems look like your thumb.
In reply to Re^7: Not an ARRAY reference
by roboticus
in thread Not an ARRAY reference
by chandantul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |