in reply to Re^2: JSON decode problem
in thread JSON decode problem

Well, that is the thing everyone is pointing out. You can either write a pre-parser that fixes it into standard JSON, then read it with the JSON modules, or parsing it yourself (which could mean you will have to implement much more).

From JSON#Data_portability_issues

Despite the widespread belief that JSON is a strict subset of JavaScript, this is not the case. Specifically, JSON allows the Unicode line terminators U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR to appear unescaped in quoted strings, while JavaScript does not. .

In "Unsupported native data types" Wikipedia specifically states for Date() that there are some de facto standards, e.g., converting from Date to String, but none universally recognized. This JSON is "weird" like that.

So each line is an identifier: thing where thing can be:

(something that must be evaluated in Javascript itself)

"{"...."}" a hash

"a string"

false a boolean

new Date(... a date

Strings and booleans are json already, the others, not that much...

Replies are listed 'Best First'.
Re^4: JSON decode problem
by kennethk (Abbot) on Aug 15, 2016 at 15:45 UTC
    As fellow monks have said, the problem here is that it is not portable json, it needs to be evalled into a javascript environment, like your browser.
    This was the specific point I was replying to. It is not valid JavaScript due to unescaped quotes, and therefore you can't leverage a JavaScript interpreter.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.