JSON Debug
JSON
is a data format,
originally designed from Javascript (JavaScript Object Notation),
but works as a common data interchange format across a variety of languages.
Simscope uses the JSON data format for most input messages and for its REST API.
Strict JSON parsing
Simscope uses a strict JSON validator for all JSON inputs. Any JSON that is invalid will
be rejected, and usually a WARN
ing will be printed to stdout
.
For example, the following JSON:
{
"alpha": true,
"beta": false,
}
... is invalid, due to a trailing comma after the beta
line.
Debug: Validating JSON interactively
If you are getting JSON parse errors/warnings from Simscope, you should run the JSON through the online JSONLint validator. This tool gives useful errors as to where the parse error is.
Using the above JSON example, JSONLint prints the following error:
Error: Parse error on line 3:
...ue, "beta": false,}
---------------------^
Expecting 'STRING', got '}'