Metadata-Version: 2.1
Name: json-duplicate-keys
Version: 23.2.7
Summary: Flatten/ Unflatten and Load(s)/ Dump(s) JSON File/ Object with Duplicate Keys
Home-page: https://github.com/truocphan/json_duplicate_keys
Author: Truoc Phan
Author-email: truocphan112017@gmail.com
License: MIT
Keywords: json,duplicate keys,json duplicate keys,flatten,unflatten
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: Implementation :: Jython
Description-Content-Type: text/markdown
License-File: LICENSE

# JSON Duplicate Keys
Flatten/ Unflatten and Load(s)/ Dump(s) JSON File/ Object with Duplicate Keys

## Installation
```console
pip install json-duplicate-keys
```

## Usage
```python
>>> import json_duplicate_keys
>>>
>>> Jstr = '{"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "22.3.3", "version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}'
>>> Jobj = json_duplicate_keys.loads(Jstr)
>>> Jobj
{'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest', 'release': [{'version': '22.3.3', 'version{{{_2_}}}': 'latest'}], 'snapshot': {'author': 'truocphan', 'version': '22.3.3', 'release': [{'version': 'latest'}]}}
>>>
>>> Jobj["version{{{_2_}}}"] = "22.3.14"
>>> Jobj
{'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': '22.3.14', 'release': [{'version': '22.3.3', 'version{{{_2_}}}': 'latest'}], 'snapshot': {'author': 'truocphan', 'version': '22.3.3', 'release': [{'version': 'latest'}]}}
>>> json_duplicate_keys.dumps(Jobj)
'{"author": "truocphan", "version": "22.3.3", "version": "22.3.14", "release": [{"version": "22.3.3", "version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}'
>>>
>>> Jobj
{'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': '22.3.14', 'release': [{'version': '22.3.3', 'version{{{_2_}}}': 'latest'}], 'snapshot': {'author': 'truocphan', 'version': '22.3.3', 'release': [{'version': 'latest'}]}}
>>> Jflat = json_duplicate_keys.flatten(Jobj)
>>> Jflat
{'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': '22.3.14', 'release||$0$||version': '22.3.3', 'release||$0$||version{{{_2_}}}': 'latest', 'snapshot||author': 'truocphan', 'snapshot||version': '22.3.3', 'snapshot||release||$0$||version': 'latest'}
>>>
>>> Jflat['snapshot||release||$0$||version'] = "22.3.14"
>>> Jflat
{'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': '22.3.14', 'release||$0$||version': '22.3.3', 'release||$0$||version{{{_2_}}}': 'latest', 'snapshot||author': 'truocphan', 'snapshot||version': '22.3.3', 'snapshot||release||$0$||version': '22.3.14'}
>>>
>>> json_duplicate_keys.unflatten(Jflat)
{'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': '22.3.14', 'release': [{'version': '22.3.3', 'version{{{_2_}}}': 'latest'}], 'snapshot': {'author': 'truocphan', 'version': '22.3.3', 'release': [{'version': '22.3.14'}]}}
```
