spa: spa-json-dump: read also from stdin, and report syntax errors

Support reading from stdin and report syntax errors.

Also don't do extra spa_json_enter when inserting a dummy "{" when
parsing files with top-level keys.  In this case the tokenizer is
already "entered" after spa_json_init, and will give parse error when we
are not inserting the closing "}" for the dummy "{".
This commit is contained in:
Pauli Virtanen 2024-03-23 20:58:37 +02:00
parent 3775e4e624
commit 7f5e0f0425
2 changed files with 109 additions and 28 deletions

View file

@ -4,11 +4,11 @@ SPA JSON to JSON converter
# SYNOPSIS
**spa-json** *FILE*
**spa-json** *[FILE]*
# DESCRIPTION
Reads a SPA JSON file, and outputs it as standard JSON.
Reads a SPA JSON file or stdin, and outputs it as standard JSON.
# EXAMPLES