jsonofabitch


Namejsonofabitch JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/cmark0v/jsonofabitch/
SummaryJSOB: Fault tolerant JSON parser. A standardization of low standards. Be a JSLOB.
upload_time2023-12-03 15:25:53
maintainer
docs_urlNone
authorcmark0v
requires_python>=3.6
licenseMIT
keywords json parser linter autocorrect formatter jslob user input
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## JSONofabitch

- fault tolerant json parser
- JSON correction/formatting engine
- stochastic ascii structured data format
- a standard for low standards
- the *retard proof* multi-parameter, multi-type input parser
- a troll of api scraping reverse engineers
- a JSON of a bitch!


functions
---------

- ``loads()`` - loads JSLOB compliant text 
- ``dumps()`` - dumps regular JSON
- ``correct()`` - turns JSLOB to JSON 
- ``dumpslob()`` - dumps stochastic JSLOB

install
-------

```
pip3 install jsonofabitch
```

build requires ``lark`` but ``jsonofabitch`` is stand-alone


JSLOB syntax
------------

- keypairs -  ``:`` or ``=`` separate key value pairs, whitespace is ignored  ``'g=5' -> {"g": 5}`` and ``'g:5' -> {"g": 5}``, such keypairs are implicitly assumed to be in a JSLOB object which resolves to a python dict
- keys - double quoted string or alphanumeric plus ``_-~$@&?.%<>#!^+/*``(no spaces,no unicode)  non-numeric first character. 
- values - another JSLOB object, a tupple, a list, string without quotes, quote-enclosed string, boolean ``true`` ``false`` , ``null`` , integers, floats
- ``'true' -> True`` ``'false' -> False`` ``'null' -> None`` case sensitive
- tuples in ``( )`` lists in ``[ ]`` objects separated by comma ``,`` or semicolon ``;`` . trailing comma/semicolon okay
- dicts/JSLOB objects have keypairs separated by semicolon or comma, nested jslob objects(in lists, tuples or jslob objects) are terminated and separated simultaneously by ``;;`` or ``,,`` , IE: ``'[g=5,h=3]' -> [{'g': 5, 'h': 3}]`` and ``'[g=5;;h=3]' -> [{'g': 5}, {'h': 3}]``
- strings - same as keys, mostly only need quotes for numeric first character or if it includes spaces.
- scientific notation ``2e4`` resolves to $2.0 * 10^4$, always resolve to float
- numbers with decimal present resolve to floats while others resolve to ints IE ``'3.0' -> 3.0`` and ``'3' -> 3`` ``'3.' -> 3.0``


about/conventions
-----------------

- the parser is called JSOB(*jay-sawb*) in polite company
- the standardized syntax is called JSLOB (*jay-slawb*)
- suggested file extension ``.jslob`` or ``.slob`` or ``.jsob`` 
- the underlying parser is built using ``lark`` which generates stand-alone python from the lark meta-langauge that defines the grammar


changelog
---------

- ``0.4.0`` - add support for a wider range of characters in unquoted strings
- ``0.3.5`` - fix handling of empty lists, tuples, improve approach to handling empty JSLOB objects
- ``0.3.2`` - fix improper handling of ``None`` and bools by dumps functions
- version ``0.3.0`` transitioned from using the parseing library ``lark`` at runtime to a stand-alone parser generated by lark at build

examples
--------

```python
import jsonofabitch as jsob
d = jsob.loads("f=5, size=big, style=SLOB, coord=[(3,4),(1.2,3)]")
#{'f': 5, 'size': 'big', 'style': 'SLOB', 'coord': [(3, 4), (1.2, 3)]}

jsob.dumps(d)
#Out[3]: '{"f": 5, "size": "big", "style": "SLOB", "coord": [[3, 4], [1.2, 3]]}'

jsob.dumpslob(d)
#Out[4]: ' "f"=  5;  "size"="big";style=  "SLOB";  coord: [ (3 ,4 ), (1.2, 3,)  ];'

jsob.dumpslob(d)
#Out[5]: ' "f"= 5;size="big", style: SLOB, "coord": [ (3, 4 ),(1.2 , 3  ) ];'

jsob.dumpslob(d)
#Out[6]: ' "f"= 5,  size=  "big",style=  "SLOB";  coord:  [ (3,4 ,) ,(1.2 , 3,)  ];'
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cmark0v/jsonofabitch/",
    "name": "jsonofabitch",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "json,parser,linter,autocorrect,formatter,jslob,user input",
    "author": "cmark0v",
    "author_email": "c mark0v <cmark0v@protonmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/63/0d/6528a8b702d427c7f8edb8205b2fbd2258909554257f6890d21ea4254671/jsonofabitch-0.4.0.tar.gz",
    "platform": null,
    "description": "## JSONofabitch\n\n- fault tolerant json parser\n- JSON correction/formatting engine\n- stochastic ascii structured data format\n- a standard for low standards\n- the *retard proof* multi-parameter, multi-type input parser\n- a troll of api scraping reverse engineers\n- a JSON of a bitch!\n\n\nfunctions\n---------\n\n- ``loads()`` - loads JSLOB compliant text \n- ``dumps()`` - dumps regular JSON\n- ``correct()`` - turns JSLOB to JSON \n- ``dumpslob()`` - dumps stochastic JSLOB\n\ninstall\n-------\n\n```\npip3 install jsonofabitch\n```\n\nbuild requires ``lark`` but ``jsonofabitch`` is stand-alone\n\n\nJSLOB syntax\n------------\n\n- keypairs -  ``:`` or ``=`` separate key value pairs, whitespace is ignored  ``'g=5' -> {\"g\": 5}`` and ``'g:5' -> {\"g\": 5}``, such keypairs are implicitly assumed to be in a JSLOB object which resolves to a python dict\n- keys - double quoted string or alphanumeric plus ``_-~$@&?.%<>#!^+/*``(no spaces,no unicode)  non-numeric first character. \n- values - another JSLOB object, a tupple, a list, string without quotes, quote-enclosed string, boolean ``true`` ``false`` , ``null`` , integers, floats\n- ``'true' -> True`` ``'false' -> False`` ``'null' -> None`` case sensitive\n- tuples in ``( )`` lists in ``[ ]`` objects separated by comma ``,`` or semicolon ``;`` . trailing comma/semicolon okay\n- dicts/JSLOB objects have keypairs separated by semicolon or comma, nested jslob objects(in lists, tuples or jslob objects) are terminated and separated simultaneously by ``;;`` or ``,,`` , IE: ``'[g=5,h=3]' -> [{'g': 5, 'h': 3}]`` and ``'[g=5;;h=3]' -> [{'g': 5}, {'h': 3}]``\n- strings - same as keys, mostly only need quotes for numeric first character or if it includes spaces.\n- scientific notation ``2e4`` resolves to $2.0 * 10^4$, always resolve to float\n- numbers with decimal present resolve to floats while others resolve to ints IE ``'3.0' -> 3.0`` and ``'3' -> 3`` ``'3.' -> 3.0``\n\n\nabout/conventions\n-----------------\n\n- the parser is called JSOB(*jay-sawb*) in polite company\n- the standardized syntax is called JSLOB (*jay-slawb*)\n- suggested file extension ``.jslob`` or ``.slob`` or ``.jsob`` \n- the underlying parser is built using ``lark`` which generates stand-alone python from the lark meta-langauge that defines the grammar\n\n\nchangelog\n---------\n\n- ``0.4.0`` - add support for a wider range of characters in unquoted strings\n- ``0.3.5`` - fix handling of empty lists, tuples, improve approach to handling empty JSLOB objects\n- ``0.3.2`` - fix improper handling of ``None`` and bools by dumps functions\n- version ``0.3.0`` transitioned from using the parseing library ``lark`` at runtime to a stand-alone parser generated by lark at build\n\nexamples\n--------\n\n```python\nimport jsonofabitch as jsob\nd = jsob.loads(\"f=5, size=big, style=SLOB, coord=[(3,4),(1.2,3)]\")\n#{'f': 5, 'size': 'big', 'style': 'SLOB', 'coord': [(3, 4), (1.2, 3)]}\n\njsob.dumps(d)\n#Out[3]: '{\"f\": 5, \"size\": \"big\", \"style\": \"SLOB\", \"coord\": [[3, 4], [1.2, 3]]}'\n\njsob.dumpslob(d)\n#Out[4]: ' \"f\"=  5;  \"size\"=\"big\";style=  \"SLOB\";  coord: [ (3 ,4 ), (1.2, 3,)  ];'\n\njsob.dumpslob(d)\n#Out[5]: ' \"f\"= 5;size=\"big\", style: SLOB, \"coord\": [ (3, 4 ),(1.2 , 3  ) ];'\n\njsob.dumpslob(d)\n#Out[6]: ' \"f\"= 5,  size=  \"big\",style=  \"SLOB\";  coord:  [ (3,4 ,) ,(1.2 , 3,)  ];'\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "JSOB: Fault tolerant JSON parser. A standardization of low standards. Be a JSLOB.",
    "version": "0.4.0",
    "project_urls": {
        "Homepage": "https://github.com/cmark0v/jsonofabitch/"
    },
    "split_keywords": [
        "json",
        "parser",
        "linter",
        "autocorrect",
        "formatter",
        "jslob",
        "user input"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "df8ce40e38a4d59a98de456ed540ee41710875f2479caf7d730f8fb2bd3fef39",
                "md5": "d150fc933bbed9144a9517f9573a4062",
                "sha256": "ec0d7d0188ac351c35aa775fe93d7beb8e4b98ddc26f484918a99cf34d854f6b"
            },
            "downloads": -1,
            "filename": "jsonofabitch-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d150fc933bbed9144a9517f9573a4062",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 36134,
            "upload_time": "2023-12-03T15:25:50",
            "upload_time_iso_8601": "2023-12-03T15:25:50.699392Z",
            "url": "https://files.pythonhosted.org/packages/df/8c/e40e38a4d59a98de456ed540ee41710875f2479caf7d730f8fb2bd3fef39/jsonofabitch-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "630d6528a8b702d427c7f8edb8205b2fbd2258909554257f6890d21ea4254671",
                "md5": "3348d59667b6a571e9ac5f5759004b79",
                "sha256": "bb6f1feedbbba9c2fdfca3547e75d43167beec55bdce5a473e1438eeaf857b8c"
            },
            "downloads": -1,
            "filename": "jsonofabitch-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "3348d59667b6a571e9ac5f5759004b79",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 6616,
            "upload_time": "2023-12-03T15:25:53",
            "upload_time_iso_8601": "2023-12-03T15:25:53.309847Z",
            "url": "https://files.pythonhosted.org/packages/63/0d/6528a8b702d427c7f8edb8205b2fbd2258909554257f6890d21ea4254671/jsonofabitch-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-03 15:25:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cmark0v",
    "github_project": "jsonofabitch",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "jsonofabitch"
}
        
Elapsed time: 0.15893s