Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
simplejson
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenVMS
Python
Modules
simplejson
Commits
76fb7d24552c
Commit
76fb7d24552c
authored
13 years ago
by
Bob Ippolito
Browse files
Options
Downloads
Patches
Plain Diff
update docs with namedtuple encoding to JSON object
parent
451987014e15
Loading
Loading
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGES.txt
+4
-1
4 additions, 1 deletion
CHANGES.txt
index.rst
+4
-1
4 additions, 1 deletion
index.rst
simplejson/encoder.py
+1
-1
1 addition, 1 deletion
simplejson/encoder.py
with
9 additions
and
3 deletions
CHANGES.txt
+
4
−
1
View file @
76fb7d24
Version 2.
1.7
released 2011-XX-XX
Version 2.
2.0
released 2011-XX-XX
...
...
@@ -2,4 +2,7 @@
* namedtuple (or other tuple subclasses with _asdict methods) are now
encoded as JSON objects rather than arrays.
https://github.com/simplejson/simplejson/pull/6
* JSONDecodeError is now raised instead of ValueError when a document
ends with an opening quote and the C speedups are in use.
https://github.com/simplejson/simplejson/issues/15
...
...
This diff is collapsed.
Click to expand it.
index.rst
+
4
−
1
View file @
76fb7d24
...
...
@@ -399,7 +399,7 @@
+-------------------+---------------+
| Python | JSON |
+===================+===============+
| dict
| object |
| dict
, namedtuple
| object |
+-------------------+---------------+
| list, tuple | array |
+-------------------+---------------+
...
...
@@ -414,6 +414,9 @@
| None | null |
+-------------------+---------------+
.. versionchanged:: 2.2.0
Changed *namedtuple* encoding from JSON array to object.
To extend this to recognize other objects, subclass and implement a
:meth:`default` method with another method that returns a serializable object
for ``o`` if possible, otherwise it should call the superclass implementation
...
...
This diff is collapsed.
Click to expand it.
simplejson/encoder.py
+
1
−
1
View file @
76fb7d24
...
...
@@ -80,7 +80,7 @@
+-------------------+---------------+
| Python | JSON |
+===================+===============+
| dict
| object |
| dict
, namedtuple
| object |
+-------------------+---------------+
| list, tuple | array |
+-------------------+---------------+
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment