GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - simplejson/simplejson: simplejson is a simple, fast, extensible JSON encoder/decoder for Python

BranchesTags
Open more actions menu

Latest commit

 

History

720 Commits
720 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.vscode
.vscode
 
 
scripts
scripts
 
 
simplejson
simplejson
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
AGENTS.md
AGENTS.md
 
 
CHANGES.txt
CHANGES.txt
 
 
LICENSE.txt
LICENSE.txt
 
 
MANIFEST.in
MANIFEST.in
 
 
README.rst
README.rst
 
 
conf.py
conf.py
 
 
index.rst
index.rst
 
 
pyproject.toml
pyproject.toml
 
 
setup.py
setup.py
 
 
tsan_stress_simplejson.py
tsan_stress_simplejson.py
 
 

Repository files navigation

simplejson

simplejson is a simple, fast, complete, correct and extensible JSON <http://json.org> encoder and decoder for Python 3.9+ with legacy support for Python 2.7. It is pure Python code with no dependencies, but includes an optional C extension for a serious speed boost.

The latest documentation for simplejson can be read online here: https://simplejson.readthedocs.io/

simplejson is the externally maintained development version of the json library included with Python (since 2.6). This version is tested with Python 3.14 (including free-threaded builds) and maintains backwards compatibility with Python 3.9+. A legacy Python 2.7 wheel is also published.

The encoder can be specialized to provide serialization in any kind of situation, without any special support by the objects to be serialized (somewhat like pickle). This is best done with the default kwarg to dumps.

The decoder can handle incoming JSON strings of any specified encoding (UTF-8 by default). It can also be specialized to post-process JSON objects with the object_hook or object_pairs_hook kwargs. This is particularly useful for implementing protocols such as JSON-RPC that have a richer type system than JSON itself.

For those of you that have legacy systems to maintain, there is a very old fork of simplejson in the python2.2 branch that supports Python 2.2. This is based on a very old version of simplejson, is not maintained, and should only be used as a last resort.

RawJSON

RawJSON allows embedding pre-encoded JSON strings into output without re-encoding them.

This can be useful in advanced cases where JSON content is already serialized and re-encoding would be unnecessary.

Example usage:

from simplejson import dumps, RawJSON

payload = {
    "status": "ok",
    "data": RawJSON('{"a": 1, "b": 2}')
}

print(dumps(payload))
# Output: {"status": "ok", "data": {"a": 1, "b": 2}}

Caveat: RawJSON should be used with care. It bypasses normal serialization and validation, and is not recommended for general use unless the embedded JSON content is fully trusted.

About

simplejson is a simple, fast, extensible JSON encoder/decoder for Python

simplejson.readthedocs.io/

Topics

jsonjson-parserjson-serializerpythonpython2python3

Resources

Readme
License
Activity
Custom properties

Stars

1.7k stars

Watchers

54 watching

Forks

371 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.