Skip to main content

JSON for Humans in Python.

Project description

PyPI

JSON for Humans.

JSON is great. Until you miss that trailing comma... or want to use comments. What about multiline strings? JSONH provides a much more elegant way to write JSON that's designed for humans rather than machines.

Since JSONH is compatible with JSON, any JSONH syntax can be represented with equivalent JSON.

JsonhPy

JsonhPy is a parser implementation of JSONH V1 & V2 for Python 3.

Example

{
    // use #, // or /**/ comments
    
    // quotes are optional
    keys: without quotes,

    // commas are optional
    isn\'t: {
        that: cool? # yes
    }

    // use multiline strings
    haiku: '''
        Let me die in spring
          beneath the cherry blossoms
            while the moon is full.
        '''
    
    // compatible with JSON5
    key: 0xDEADCAFE

    // or use JSON
    "old school": 1337
}

Usage

Everything you need is contained within JsonhReader:

from JsonhPy.JsonhPy import *

jsonh: str = """
{
    this is: awesome
}
"""
json: object = JsonhReader.parse_element_from_string(jsonh).value()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsonhpy-2.4.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsonhpy-2.4-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file jsonhpy-2.4.tar.gz.

File metadata

  • Download URL: jsonhpy-2.4.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for jsonhpy-2.4.tar.gz
Algorithm Hash digest
SHA256 5fecf797dc332852b2d64389be3777dc676a8e8afd1b47a53da7db08610e99e3
MD5 4e6b0eb62dc0bb98755ccf0beabc890a
BLAKE2b-256 c905ef732aa9875037bb3b0a7c13e734c1b67ed65b8791d54d476a348d42841e

See more details on using hashes here.

File details

Details for the file jsonhpy-2.4-py3-none-any.whl.

File metadata

  • Download URL: jsonhpy-2.4-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for jsonhpy-2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9eb927f42791f383faa161fdfb29084a9e4d53298ac64d66c9e98b5666cd98c2
MD5 d460bc4c6bbbfec6807aba4b1c6bdc63
BLAKE2b-256 070699943a92b5703602b9e840c51c8feeeeee60f28fcdb9e5e8c3d6e01fc5b7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page