plotly.io.to_json

plotly.io.to_json(fig, validate=True, pretty=False, remove_uids=True)

Convert a figure to a JSON string representation

Parameters
  • fig – Figure object or dict representing a figure

  • validate (bool (default True)) – True if the figure should be validated before being converted to JSON, False otherwise.

  • pretty (bool (default False)) – True if JSON representation should be pretty-printed, False if representation should be as compact as possible.

  • remove_uids (bool (default True)) – True if trace UIDs should be omitted from the JSON representation

Returns

Representation of figure as a JSON string

Return type

str