diff --git a/CHANGES.md b/CHANGES.md index 4b3684e..e0cc951 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ * Update idna library 2.7 (0f50bdc) to 2.8 (032fc55) * Update MsgPack 0.5.6 (d4675be) to 0.6.0 (197e307) * Update Requests library 2.19.1 (2c6a842) to 2.20.1 (57d7284) +* Update SimpleJSON 3.16.0 (e2a54f7) to 3.16.1 (ce75e60) * Update Six compatibility library 1.11.0 (68112f3) to 1.11.0 (0b4265e) * Update urllib3 release 1.23 (7c216f4) to 1.24.1 (a6ec68a) * Change suppress logging false positive of bad Emby request diff --git a/lib/simplejson/__init__.py b/lib/simplejson/__init__.py index 0556a7a..9d9b737 100644 --- a/lib/simplejson/__init__.py +++ b/lib/simplejson/__init__.py @@ -87,7 +87,6 @@ Specializing JSON object encoding:: >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' - Using simplejson.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m simplejson.tool @@ -96,9 +95,30 @@ Using simplejson.tool from the shell to validate and pretty-print:: } $ echo '{ 1.2:3.4}' | python -m simplejson.tool Expecting property name: line 1 column 3 (char 2) + +Parsing multiple documents serialized as JSON lines (newline-delimited JSON):: + + >>> import simplejson as json + >>> def loads_lines(docs): + ... for doc in docs.splitlines(): + ... yield json.loads(doc) + ... + >>> sum(doc["count"] for doc in loads_lines('{"count":1}\n{"count":2}\n{"count":3}\n')) + 6 + +Serializing multiple objects to JSON lines (newline-delimited JSON):: + + >>> import simplejson as json + >>> def dumps_lines(objs): + ... for obj in objs: + ... yield json.dumps(obj, separators=(',',':')) + '\n' + ... + >>> ''.join(dumps_lines([{'count': 1}, {'count': 2}, {'count': 3}])) + '{"count":1}\n{"count":2}\n{"count":3}\n' + """ from __future__ import absolute_import -__version__ = '3.16.0' +__version__ = '3.16.1' __all__ = [ 'dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONDecodeError', 'JSONEncoder',