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

Method to_json

plotly/basedatatypes.py:5665–5696  ·  view source on GitHub ↗

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

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

5663 return deepcopy(self._props if self._props is not None else {})
5664
5665 def to_json(self, *args, **kwargs):
5666 """
5667 Convert object to a JSON string representation
5668
5669 Parameters
5670 ----------
5671 validate: bool (default True)
5672 True if the object should be validated before being converted to
5673 JSON, False otherwise.
5674
5675 pretty: bool (default False)
5676 True if JSON representation should be pretty-printed, False if
5677 representation should be as compact as possible.
5678
5679 remove_uids: bool (default True)
5680 True if trace UIDs should be omitted from the JSON representation
5681
5682 engine: str (default None)
5683 The JSON encoding engine to use. One of:
5684 - "json" for an encoder based on the built-in Python json module
5685 - "orjson" for a fast encoder the requires the orjson package
5686 If not specified, the default encoder is set to the current value of
5687 plotly.io.json.config.default_encoder.
5688
5689 Returns
5690 -------
5691 str
5692 Representation of object as a JSON string
5693 """
5694 import plotly.io as pio
5695
5696 return pio.to_json(self, *args, **kwargs)
5697
5698 @staticmethod
5699 def _vals_equal(v1, v2):

Callers

nothing calls this directly

Calls 1

to_jsonMethod · 0.45

Tested by

no test coverage detected