ujson.rst 926 B

1234567891011121314151617181920212223242526272829303132333435
  1. :mod:`ujson` -- JSON encoding and decoding
  2. ==========================================
  3. .. module:: ujson
  4. :synopsis: JSON encoding and decoding
  5. |see_cpython_module| :mod:`python:json`.
  6. This modules allows to convert between Python objects and the JSON
  7. data format.
  8. Functions
  9. ---------
  10. .. function:: dump(obj, stream)
  11. Serialise *obj* to a JSON string, writing it to the given *stream*.
  12. .. function:: dumps(obj)
  13. Return *obj* represented as a JSON string.
  14. .. function:: load(stream)
  15. Parse the given *stream*, interpreting it as a JSON string and
  16. deserialising the data to a Python object. The resulting object is
  17. returned.
  18. Parsing continues until end-of-file is encountered.
  19. A :exc:`ValueError` is raised if the data in *stream* is not correctly formed.
  20. .. function:: loads(str)
  21. Parse the JSON *str* and return an object. Raises :exc:`ValueError` if the
  22. string is not correctly formed.