Open yourselvs opened 6 years ago
Hi, thanks for the report. The to_json
method needs better documentation and is still experimental. What are you trying to do?
If you're False
where you're expecting false
, I guess that's because to_json
returns a Python diction that's ready to be serialised to JSON -- not a JSON string. Maybe it's a bad name. You can write it to a file using something like
with open(filename, 'wt') as f:
json.dump(sankeydata.to_json(), f)
My goal was just to get a JSON representing the Sankey diagram. What came out was good enough, and easy enough to format, but I didn't know what the 'format'
or 'metadata'
fields were used for or if they should've been showing up.
Makes sense. Hopefully we can tidy all this up and document it soon (contributions welcome!)
The format
field is intended to keep track of the format, inspired by the Jupyter notebook format.
metadata
includes the title and authors of the diagram (optionally) and information about how it should be laid out (layers
) which are not a necessary part of the data itself.
The SankeyData's
to_json
method will always return Json in a widget format. The'format'
and'metadata'
fields are missing, and the'order'
field is included, even if there is no "format" argument passed into the method. The output also has single quotes instead of double quotes,False
instead offalse
, and uses parenthesis for'order'
tuples instead of brackets.