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
86b358ddf4ec
Commit
86b358ddf4ec
authored
14 years ago
by
Bob Ippolito
Browse files
Options
Downloads
Patches
Plain Diff
document JSONDecodeError
https://github.com/simplejson/simplejson/issues/12
parent
31f4f0fb52d8
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGES.txt
+1
-0
1 addition, 0 deletions
CHANGES.txt
index.rst
+51
-5
51 additions, 5 deletions
index.rst
with
52 additions
and
5 deletions
CHANGES.txt
+
1
−
0
View file @
86b358dd
Version 2.1.7 released 2011-XX-XX
* Updated documentation with information about JSONDecodeError
* Force unicode linebreak characters to be escaped (U+2028 and U+2029)
http://timelessrepo.com/json-isnt-a-javascript-subset
* Moved documentation from a git submodule to
...
...
This diff is collapsed.
Click to expand it.
index.rst
+
51
−
5
View file @
86b358dd
...
...
@@ -206,7 +206,8 @@
.. function:: load(fp[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, use_decimal[, **kw]]]]]]]]])
Deserialize *fp* (a ``.read()``-supporting file-like object containing a JSON
document) to a Python object.
document) to a Python object. :exc:`JSONDecodeError` will be
raised if the given JSON document is not valid.
If the contents of *fp* are encoded with an ASCII based encoding other than
UTF-8 (e.g. latin-1), then an appropriate *encoding* name must be specified.
...
...
@@ -273,7 +274,8 @@
.. function:: loads(s[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, use_decimal[, **kw]]]]]]]]])
Deserialize *s* (a :class:`str` or :class:`unicode` instance containing a JSON
document) to a Python object.
document) to a Python object. :exc:`JSONDecodeError` will be
raised if the given JSON document is not valid.
If *s* is a :class:`str` instance and is encoded with an ASCII based encoding
other than UTF-8 (e.g. latin-1), then an appropriate *encoding* name must be
...
...
@@ -373,6 +375,9 @@
appropriate solution is decode *s* to :class:`unicode` prior to calling
decode.
:exc:`JSONDecodeError` will be raised if the given JSON
document is not valid.
.. method:: raw_decode(s)
Decode a JSON document from *s* (a :class:`str` or :class:`unicode`
...
...
@@ -382,6 +387,8 @@
This can be used to decode a JSON document from a string that may have
extraneous data at the end.
:exc:`JSONDecodeError` will be raised if the given JSON
document is not valid.
.. class:: JSONEncoder([skipkeys[, ensure_ascii[, check_circular[, allow_nan[, sort_keys[, indent[, separators[, encoding[, default]]]]]]]]])
...
...
@@ -504,3 +511,42 @@
.. versionchanged:: 2.1.0
New in 2.1.0
Exceptions
----------
.. exception:: JSONDecodeError(msg, doc, pos[, end])
Subclass of :exc:`ValueError` with the following additional attributes:
.. attribute:: msg
The unformatted error message
.. attribute:: doc
The JSON document being parsed
.. attribute:: pos
The start index of doc where parsing failed
.. attribute:: end
The end index of doc where parsing failed (may be ``None``)
.. attribute:: lineno
The line corresponding to pos
.. attribute:: colno
The column corresponding to pos
.. attribute:: endlineno
The line corresponding to end (may be ``None``)
.. attribute:: endcolno
The column corresponding to end (may be ``None``)
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