Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Creating a PR before I merge, since this is potentially a breaking change.
Current JSON formats for proofs and rewrites have JSON containing strings containing JSON (which sometimes contain strings containing JSON containing strings containing JSON...).
Technically this works, but its a bit clunky to run the JSON parser many times to load a single file, especially if you want to consume JSON in an external tool. This branch gets rid of the nested JSON strings by splitting the old
to_json
method into two parts:to_dict
which serialises to a python dict, then a thin wrapperto_json
which just calledjson.dumps
on the output ofto_dict
. Nested structures are added directly as dicts rather than strings.The
from_json
will either accept a string (in which case it parses JSON first) or a python dict. Hence, ZX live can still read old-style files, but it will save in the new format.Note this needs zxcalc/pyzx@aab09ad .