MCPcopy Create free account
hub / github.com/plotly/plotly.py / to_json

Method to_json

plotly/basedatatypes.py:3422–3453  ·  view source on GitHub ↗

Convert a figure to a JSON string representation Parameters ---------- validate: bool (default True) True if the figure should be validated before being converted to JSON, False otherwise. pretty: bool (default False) Tru

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

3420 return pio.show(self, *args, **kwargs)
3421
3422 def to_json(self, *args, **kwargs):
3423 """
3424 Convert a figure to a JSON string representation
3425
3426 Parameters
3427 ----------
3428 validate: bool (default True)
3429 True if the figure should be validated before being converted to
3430 JSON, False otherwise.
3431
3432 pretty: bool (default False)
3433 True if JSON representation should be pretty-printed, False if
3434 representation should be as compact as possible.
3435
3436 remove_uids: bool (default True)
3437 True if trace UIDs should be omitted from the JSON representation
3438
3439 engine: str (default None)
3440 The JSON encoding engine to use. One of:
3441 - "json" for an encoder based on the built-in Python json module
3442 - "orjson" for a fast encoder the requires the orjson package
3443 If not specified, the default encoder is set to the current value of
3444 plotly.io.json.config.default_encoder.
3445
3446 Returns
3447 -------
3448 str
3449 Representation of figure as a JSON string
3450 """
3451 import plotly.io as pio
3452
3453 return pio.to_json(self, *args, **kwargs)
3454
3455 def full_figure_for_development(self, warn=True, as_dict=False):
3456 """

Callers 15

to_jsonMethod · 0.45
test_validate_falseFunction · 0.45
test_np_geojsonMethod · 0.45
test_np_layersMethod · 0.45
test_np_rangeMethod · 0.45
test_to_jsonFunction · 0.45
test_to_json_remove_uidsFunction · 0.45
test_to_json_validateFunction · 0.45

Calls

no outgoing calls

Tested by 15

test_validate_falseFunction · 0.36
test_np_geojsonMethod · 0.36
test_np_layersMethod · 0.36
test_np_rangeMethod · 0.36
test_to_jsonFunction · 0.36
test_to_json_remove_uidsFunction · 0.36
test_to_json_validateFunction · 0.36
test_from_jsonFunction · 0.36