cirq.to_json_gzip
Write a gzipped JSON file containing a representation of obj.
cirq.to_json_gzip(
obj: Any,
file_or_fn: Union[None, IO, pathlib.Path, str] = None,
*,
indent: int = 2,
cls: Type[json.JSONEncoder] = CirqEncoder
) -> Optional[bytes]
The object may be a cirq object or have data members that are cirq
objects which implement the SupportsJSON protocol.
Args |
obj
|
An object which can be serialized to a JSON representation.
|
file_or_fn
|
A filename (if a string or pathlib.Path ) to write to, or
an IO object (such as a file or buffer) to write to, or None to
indicate that the method should return the JSON text as its result.
Defaults to None .
|
indent
|
Pretty-print the resulting file with this indent level.
Passed to json.dump.
|
cls
|
Passed to json.dump; the default value of CirqEncoder
enables the serialization of Cirq objects which implement
the SupportsJSON protocol. To support serialization of 3rd
party classes, prefer adding the _jsondict magic method
to your classes rather than overriding this default.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-27 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-27 UTC."],[],[]]