Skip to main content

JSOM - not quite JSON, but close enough

jsom is a simple and quick Python 3.7+ parser for terribly broken JSON.

Installation

$ pip install jsom

Usage

jsom works like this:

>>> import jsom
>>> broken_json = "{\"foo\": {bar: 1, 'baz':,}, bar: 1, baz: [1,2,3,],}")
>>> jsom.JsomParser(ignore_warnings=jsom.ALL_WARNINGS).loads(broken_json)
{'foo': {'bar': 1, 'baz': None}, 'bar': 1, 'baz': [1, 2, 3]}

jsom happily gobbles up the following:

  • unquoted keys and values
  • single-quoted strings
  • trailing commas
  • empty values in objects

By default, it will warn you whenever it sees one of those, but still parse it.

It also doesn't give a shit about:

  • Newlines in strings
  • Stray backslashes

You will never get warned about those. ¯\_(ツ)_/¯

Warnings are annoying, though, and to make matters worse, they slow the parser down - so just pass in the list of warnings you want jsom to be quiet about in the ignore_warnings parameter:

parser = JsomParser(
    ignore_warnings=[jsom.SINGLE_QUOTED_STRING, jsom.EMPTY_OBJECT_VALUE]
)

Or, if you prefer, just tell it to shut up completely, by passing in jsom.ALL_WARNINGS.

LICENSE

jsom is distributed under the terms of the Do What The Fuck You Want To Public License (WTFPL):

        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
                    Version 2, December 2004 

 Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> 

 Everyone is permitted to copy and distribute verbatim or modified 
 copies of this license document, and changing it is allowed as long 
 as the name is changed. 

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 

  0. You just DO WHAT THE FUCK YOU WANT TO.

Metadata

Release files for jsom 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jsom 0.0.5
File Size Uploaded Provenance Actions
jsom-0.0.5.tar.gz 7.2 kB Without provenance Details for jsom-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jsom 0.0.5
File Interpreter ABI Platform Actions
jsom-0.0.5-py3-none-any.whl Python 3 none any Details for jsom-0.0.5-py3-none-any.whl

Total release size: 16.0 kB

Release files / jsom-0.0.5.tar.gz

Download URL jsom-0.0.5.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
284d75e501c464e52157f7d9b00cfea72bdcf6b697eb8e7dc010cb65ee2d504f
BLAKE2b-256 checksum
How to use checksums
3e7eb7ece3aa62331115334b26a6a5d9c7b441d8afb37f5f4591127ead425b7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

Release files / jsom-0.0.5-py3-none-any.whl

Download URL jsom-0.0.5-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f50eb5bb9a2934e4abc6b392dc23dc2fb6532e4852d4f3664e9d6187e10bc5d0
BLAKE2b-256 checksum
How to use checksums
19a29c993b4de16db99a0c65437db60d02abf072cbdb64b0a87ecb0d6829f55c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

Security for jsom 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page