Draft: First working attempt at producing valid json from --show-members-json option.
This writes out all members as list entries. Each member writes out each part as nested list entries as well. Since nested lists are used, the order of the members and parts is preserved in JSON format.
Each part is written as an object with either "name" or "index" properties. Units are added as an object with a "unit" property.
The format is quite verbose, but it is not meant for regular human consumption. The format also goes so far as to replace 'zzp' with 'sparse'.
Use with e.g.:
./xtst/xtst --show-members-json | json_pp
because it does "not" print in a very pretty way.
Missing/pitfalls:
- type of each member, because signal_id has no idea about that (yet?)
- there is a limit of 1024 characters for each member, which may not be sufficient in all cases (?)
- an empty member in the beginning is needed to make ',' insertion between list elements simple.
- whitespace is not johanssonian