Metadata-Version: 2.1
Name: JSONPath-Lite
Version: 0.0.1
Summary: A light weight json path utility for Python
Home-page: https://github.com/StephenDiscenza/jsonpath-lite-for-python
Author: Steve Discenza
Author-email: stephendiscenza@gmail.com
License: UNKNOWN
Project-URL: Bug Tracker, https://github.com/StephenDiscenza/jsonpath-lite-for-python/issues
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.0
Description-Content-Type: text/markdown
License-File: LICENSE

# jsonpath-lite
A very light weight utility which parses and uses JSONPath expressions to do things with the Python data structures representing a JSON document.

Does not currently support multiple field matching. This is on the todo list but many other fancier features like wildcard search are not. 

## Usage
Say you have this JSON:
```
{
    "Things": [
        {
            "Name": "Thing1",
            "Value": "Dog"
        }
    ]
}
```
If you want to get the value of a Thing Named Thing1:
`get_json_item(JSON Document, '$.Things[?Name="Thing1"].Value')`

If you want to update the value of the Thing Named Thing1 to Cat:
`update_json_element(JSON Document, '$.Things[?Name="Thing1"].Value', 'Cat')`

If you want to add a new Thing:
`write_new_json_element(JSON Document, '$.Things', {"Name": "Thing2", "Value": "Manbearpig"})`  
The arguments are: the JSON like object, path to the location of the new item, value of the new item, name of the new item.  
Note that a value is not supplied for newElementName since we are adding a new item to a list (array).

If you want to add a new field to one of the Things:
`write_new_json_element(JSON Document, $.Things[?Name="Thing1"], True, "IsAGoodBoy")`

