endplay.parsers.json
Parser for endplay formatted JSON files
Classes:
|
Class providing functionality for reading the JSON file format |
|
Class providing functionality for writing to the JSON file format |
Functions:
|
|
|
|
|
|
|
- class endplay.parsers.json.JSONDecoder(*, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None)
Bases:
JSONDecoderClass providing functionality for reading the JSON file format
- class endplay.parsers.json.JSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)
Bases:
JSONEncoderClass providing functionality for writing to the JSON file format
Methods:
default(o)Implement this method in a subclass such that it returns a serializable object for
o, or calls the base implementation (to raise aTypeError).iterencode(o[, _one_shot])Encode the given object and yield each string representation as available.
- default(o)
Implement this method in a subclass such that it returns a serializable object for
o, or calls the base implementation (to raise aTypeError).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return super().default(o)
- iterencode(o, _one_shot=False)
Encode the given object and yield each string representation as available.
For example:
for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk)
- endplay.parsers.json.dump(obj: Any, fp: IO[str], *, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: tuple[str, str] | None = None, default: Callable[[Any], Any] | None = None, sort_keys: bool = False, **kw)
- endplay.parsers.json.dumps(obj, *, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: tuple[str, str] | None = None, default: Callable[[Any], Any] | None = None, sort_keys: bool = False, **kw)
- endplay.parsers.json.load(fp, *, object_hook: Callable[[dict[Any, Any]], Any] | None = None, parse_float: Callable[[str], Any] | None = None, parse_int: Callable[[str], Any] | None = None, parse_constant: Callable[[str], Any] | None = None, object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = None, **kw)
- endplay.parsers.json.loads(s, *, object_hook: Callable[[dict[Any, Any]], Any] | None = None, parse_float: Callable[[str], Any] | None = None, parse_int: Callable[[str], Any] | None = None, parse_constant: Callable[[str], Any] | None = None, object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = None, **kw)