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 wrapper to_json which just called json.dumps on the output of to_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@aab09ad843d931c197f963729009853e92df0d09 .
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@aab09ad843d931c197f963729009853e92df0d09 .