# JsonMason
## What
A utility/library for transforming an object into an editable stream, and reconstructing an object from that stream.
To be precise:
- Transform an an object of acyclic nested collections into an iterable of assignment operations (deconstruction)
- Create an object of acyclic nested collections from an iterable of assignment operations (reconstruction)
## Why
Deconstructing only to reconstruct does not seem very useful in itself. The power is in operating on the intermediary format — the iterable of nodes
lends itself well to pattern matching, transformations, and other forms of computation.
## How
### In the shell
If you've installed this package (eg `pipx install jsonmason`), then you should have two executables on your `$PATH`. Both accept JSON on standard input, and print the deconstruction of that JSON on standard output.
* `jsonmason-nodedump` makes it easy to `grep` for patterns - this is a bit like [`gron`](https://github.com/tomnomnom/gron), but is intended to make it easy to find patterns for creating transformations in your Python code.
* `jsonmason-jsdump` is even more like , as it prints JS-style assignments that can be pasted straight into a JS console.
### In Python code
The basics:
```
from jsonmason import deconstruct, reconstruct
```
In addition there is a module `attrdict` which makes it possible to address dicts by "dot-attribute-paths" (as in JS).
```
from jsonmason import AttrDict
```
For examples, have a look at the module docstrings:
* [libjsonmason](https://github.com/blinkingtwelve/jsonmason/blob/master/doc/libjsonmason.rst)
* [attrdict](https://github.com/blinkingtwelve/jsonmason/blob/master/doc/attrdict.rst)
## Testing
Run `test.py`.
Raw data
{
"_id": null,
"home_page": "https://github.com/blinkingtwelve/jsonmason",
"name": "jsonmason",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "json",
"author": "nullenenenen",
"author_email": "nullenenenen@gavagai.eu",
"download_url": "https://files.pythonhosted.org/packages/a5/9a/15e775d25b82c31e6e7d900150e1e09e5539ec2ece08fa66a57accee5eae/jsonmason-0.2.0.tar.gz",
"platform": null,
"description": "# JsonMason\n\n## What\n\nA utility/library for transforming an object into an editable stream, and reconstructing an object from that stream.\nTo be precise:\n\n- Transform an an object of acyclic nested collections into an iterable of assignment operations (deconstruction)\n- Create an object of acyclic nested collections from an iterable of assignment operations (reconstruction)\n\n## Why\n\nDeconstructing only to reconstruct does not seem very useful in itself. The power is in operating on the intermediary format \u2014 the iterable of nodes\nlends itself well to pattern matching, transformations, and other forms of computation.\n\n## How\n\n### In the shell\n\nIf you've installed this package (eg `pipx install jsonmason`), then you should have two executables on your `$PATH`. Both accept JSON on standard input, and print the deconstruction of that JSON on standard output.\n\n* `jsonmason-nodedump` makes it easy to `grep` for patterns - this is a bit like [`gron`](https://github.com/tomnomnom/gron), but is intended to make it easy to find patterns for creating transformations in your Python code.\n* `jsonmason-jsdump` is even more like , as it prints JS-style assignments that can be pasted straight into a JS console.\n\n### In Python code\n\n\nThe basics:\n```\nfrom jsonmason import deconstruct, reconstruct\n```\n\nIn addition there is a module `attrdict` which makes it possible to address dicts by \"dot-attribute-paths\" (as in JS).\n```\nfrom jsonmason import AttrDict\n```\n\nFor examples, have a look at the module docstrings:\n\n* [libjsonmason](https://github.com/blinkingtwelve/jsonmason/blob/master/doc/libjsonmason.rst)\n* [attrdict](https://github.com/blinkingtwelve/jsonmason/blob/master/doc/attrdict.rst)\n\n## Testing\n\nRun `test.py`.\n",
"bugtrack_url": null,
"license": "Unlicense",
"summary": "jsonmason - deconstruct JSON into assignments, mangle them at will, and reconstitute JSON from the assignments.",
"version": "0.2.0",
"project_urls": {
"Documentation": "https://github.com/blinkingtwelve/jsonmason/blob/master/README.md",
"Homepage": "https://github.com/blinkingtwelve/jsonmason",
"Source": "https://github.com/blinkingtwelve/jsonmason"
},
"split_keywords": [
"json"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c35236b17f9d4d075b3e231996207b14045cc7a6477b2b27e9aad0a39358d202",
"md5": "f2a7304b3dde71055448167fdb91726d",
"sha256": "91a3db8329ec8324ef09b28f2e3986914b3b9117b3fea7ca0567622f40e21905"
},
"downloads": -1,
"filename": "jsonmason-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f2a7304b3dde71055448167fdb91726d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 7006,
"upload_time": "2023-11-27T17:57:56",
"upload_time_iso_8601": "2023-11-27T17:57:56.258216Z",
"url": "https://files.pythonhosted.org/packages/c3/52/36b17f9d4d075b3e231996207b14045cc7a6477b2b27e9aad0a39358d202/jsonmason-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a59a15e775d25b82c31e6e7d900150e1e09e5539ec2ece08fa66a57accee5eae",
"md5": "342b86f92444b4d913d2c04fc5117a24",
"sha256": "80eef1e45427e581d49ff4521c8ea236c4c3dfd3884ac411f902ec1e22e69c89"
},
"downloads": -1,
"filename": "jsonmason-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "342b86f92444b4d913d2c04fc5117a24",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 6371,
"upload_time": "2023-11-27T17:57:57",
"upload_time_iso_8601": "2023-11-27T17:57:57.518253Z",
"url": "https://files.pythonhosted.org/packages/a5/9a/15e775d25b82c31e6e7d900150e1e09e5539ec2ece08fa66a57accee5eae/jsonmason-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-27 17:57:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "blinkingtwelve",
"github_project": "jsonmason",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "jsonmason"
}