[1.1.77] Data raw dump contains invalid JSON

Post your bugs and problems so we can fix them.
Post Reply
ilbJanissary
Inserter
Inserter
Posts: 20
Joined: Tue May 28, 2019 12:34 pm
Contact:

[1.1.77] Data raw dump contains invalid JSON

Post by ilbJanissary »

When exporting data using the new --dump-data flag, the resulting JSON is invalid. There are multiple properties like:

`"literal_value": inf`

Since `inf` is not quoted, it is invalid JSON and the file cannot be parsed.

ilbJanissary
Inserter
Inserter
Posts: 20
Joined: Tue May 28, 2019 12:34 pm
Contact:

Re: [1.1.77] Data raw dump contains invalid JSON

Post by ilbJanissary »

Assuming these represent positive / negative infinity, there doesn't seem to be a supported way to represent those in JSON. I would personally find `null`, or`"inf"/"-inf"`, or `"Infinity" / "-Infinity"` acceptable (as long as those strings are quoted in order to be valid JSON).

ilbJanissary
Inserter
Inserter
Posts: 20
Joined: Tue May 28, 2019 12:34 pm
Contact:

Re: [1.1.77] Data raw dump contains invalid JSON

Post by ilbJanissary »

Bilka pointed out that the new 'dump data raw' dumps using the format our parser can handle which includes inf/nan. Looking online it seems it's not an uncommon issue other people have run into across multiple other languages/parsers.
I glossed over this comment from Rseding91 in Discord on 1/28/23 at the time but I think this describes the exact issue.

Generally I would say if JavaScript can't parse your JavaScript Object Notation you've got a problem, but if this is known and can't be resolved easily, I can always run a dirty little regex against it before I try to parse it.

Post Reply

Return to “Bug Reports”