mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Fixed #30190 -- Added JSONL serializer.
This commit is contained in:
parent
ea3beb4f5a
commit
e29637681b
6 changed files with 396 additions and 1 deletions
|
@ -160,11 +160,14 @@ Identifier Information
|
|||
|
||||
``json`` Serializes to and from JSON_.
|
||||
|
||||
``jsonl`` Serializes to and from JSONL_.
|
||||
|
||||
``yaml`` Serializes to YAML (YAML Ain't a Markup Language). This
|
||||
serializer is only available if PyYAML_ is installed.
|
||||
========== ==============================================================
|
||||
|
||||
.. _json: https://json.org/
|
||||
.. _jsonl: http://jsonlines.org/
|
||||
.. _PyYAML: https://pyyaml.org/
|
||||
|
||||
XML
|
||||
|
@ -307,6 +310,24 @@ The JSON serializer uses ``DjangoJSONEncoder`` for encoding. A subclass of
|
|||
|
||||
.. _ecma-262: https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15
|
||||
|
||||
.. _serialization-formats-jsonl:
|
||||
|
||||
JSONL
|
||||
-----
|
||||
|
||||
.. versionadded:: 3.2
|
||||
|
||||
*JSONL* stands for *JSON Lines*. With this format, objects are separated by new
|
||||
lines, and each line contains a valid JSON object. JSONL serialized data look
|
||||
like this::
|
||||
|
||||
{ "pk": "4b678b301dfd8a4e0dad910de3ae245b", "model": "sessions.session", "fields": { ... }}
|
||||
{ "pk": "88bea72c02274f3c9bf1cb2bb8cee4fc", "model": "sessions.session", "fields": { ... }}
|
||||
{ "pk": "9cf0e26691b64147a67e2a9f06ad7a53", "model": "sessions.session", "fields": { ... }}
|
||||
|
||||
JSONL can be useful for populating large databases, since the data can be
|
||||
processed line by line, rather than being loaded into memory all at once.
|
||||
|
||||
YAML
|
||||
----
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue