diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2021-08-12 13:56:13 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2021-08-13 20:31:32 +1000 |
commit | 218606351c6f9688a3f90dad791bcb2109adcf1b (patch) | |
tree | de051ee21f5ccac3aaccfe3865ab5818f81fca37 /docs/library/json.rst | |
parent | 671f012306e0942cbe59fcd43e25e67c289da351 (diff) |
docs: Rename ufoo.rst to foo.rst.
This is a simple rename of the files, no content changes
(other than updating index.rst to use the new paths)
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'docs/library/json.rst')
-rw-r--r-- | docs/library/json.rst | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/docs/library/json.rst b/docs/library/json.rst new file mode 100644 index 000000000..65ed1867e --- /dev/null +++ b/docs/library/json.rst @@ -0,0 +1,41 @@ +:mod:`ujson` -- JSON encoding and decoding +========================================== + +.. module:: ujson + :synopsis: JSON encoding and decoding + +|see_cpython_module| :mod:`python:json`. + +This modules allows to convert between Python objects and the JSON +data format. + +Functions +--------- + +.. function:: dump(obj, stream, separators=None) + + Serialise *obj* to a JSON string, writing it to the given *stream*. + + If specified, separators should be an ``(item_separator, key_separator)`` + tuple. The default is ``(', ', ': ')``. To get the most compact JSON + representation, you should specify ``(',', ':')`` to eliminate whitespace. + +.. function:: dumps(obj, separators=None) + + Return *obj* represented as a JSON string. + + The arguments have the same meaning as in `dump`. + +.. function:: load(stream) + + Parse the given *stream*, interpreting it as a JSON string and + deserialising the data to a Python object. The resulting object is + returned. + + Parsing continues until end-of-file is encountered. + A :exc:`ValueError` is raised if the data in *stream* is not correctly formed. + +.. function:: loads(str) + + Parse the JSON *str* and return an object. Raises :exc:`ValueError` if the + string is not correctly formed. |