json-duplicate-keys 2023.11.26__tar.gz → 2024.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- json-duplicate-keys-2024.2.3/PKG-INFO +352 -0
- {json-duplicate-keys-2023.11.26 → json-duplicate-keys-2024.2.3}/json_duplicate_keys/__init__.py +0 -0
- {json-duplicate-keys-2023.11.26 → json-duplicate-keys-2024.2.3}/requirements.txt +0 -0
- {json-duplicate-keys-2023.11.26 → json-duplicate-keys-2024.2.3}/setup.py +3 -4
- json-duplicate-keys-2023.11.26/LICENSE +0 -21
- json-duplicate-keys-2023.11.26/MANIFEST.in +0 -1
- json-duplicate-keys-2023.11.26/PKG-INFO +0 -353
- json-duplicate-keys-2023.11.26/README.md +0 -338
- json-duplicate-keys-2023.11.26/json_duplicate_keys.egg-info/PKG-INFO +0 -353
- json-duplicate-keys-2023.11.26/json_duplicate_keys.egg-info/SOURCES.txt +0 -10
- json-duplicate-keys-2023.11.26/json_duplicate_keys.egg-info/dependency_links.txt +0 -1
- json-duplicate-keys-2023.11.26/json_duplicate_keys.egg-info/top_level.txt +0 -1
- json-duplicate-keys-2023.11.26/setup.cfg +0 -4
@@ -0,0 +1,352 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: json-duplicate-keys
|
3
|
+
Version: 2024.2.3
|
4
|
+
Summary: Flatten/ Unflatten and Load(s)/ Dump(s) JSON File/ Object with Duplicate Keys
|
5
|
+
Home-page: https://github.com/truocphan/json-duplicate-keys
|
6
|
+
Author: TP Cyber Security
|
7
|
+
Author-email: tpcybersec2023@gmail.com
|
8
|
+
License: MIT
|
9
|
+
Description: # JSON Duplicate Keys
|
10
|
+
Flatten/ Unflatten and Load(s)/ Dump(s) JSON File/ Object with Duplicate Keys
|
11
|
+
|
12
|
+
<p align="center">
|
13
|
+
<a href="https://github.com/truocphan/json_duplicate_keys/releases/"><img src="https://img.shields.io/github/release/truocphan/json_duplicate_keys" height=30></a>
|
14
|
+
<a href="#"><img src="https://img.shields.io/github/downloads/truocphan/json_duplicate_keys/total" height=30></a>
|
15
|
+
<a href="#"><img src="https://img.shields.io/github/stars/truocphan/json_duplicate_keys" height=30></a>
|
16
|
+
<a href="#"><img src="https://img.shields.io/github/forks/truocphan/json_duplicate_keys" height=30></a>
|
17
|
+
<a href="https://github.com/truocphan/json_duplicate_keys/issues?q=is%3Aopen+is%3Aissue"><img src="https://img.shields.io/github/issues/truocphan/json_duplicate_keys" height=30></a>
|
18
|
+
<a href="https://github.com/truocphan/json_duplicate_keys/issues?q=is%3Aissue+is%3Aclosed"><img src="https://img.shields.io/github/issues-closed/truocphan/json_duplicate_keys" height=30></a>
|
19
|
+
<a href="https://pypi.org/project/json-duplicate-keys/" target="_blank"><img src="https://img.shields.io/badge/pypi-3775A9?style=for-the-badge&logo=pypi&logoColor=white" height=30></a>
|
20
|
+
<a href="https://www.facebook.com/61550595106970" target="_blank"><img src="https://img.shields.io/badge/Facebook-1877F2?style=for-the-badge&logo=facebook&logoColor=white" height=30></a>
|
21
|
+
<a href="https://twitter.com/TPCyberSec" target="_blank"><img src="https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white" height=30></a>
|
22
|
+
<a href="https://github.com/truocphan" target="_blank"><img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white" height=30></a>
|
23
|
+
<a href="mailto:tpcybersec2023@gmail.com" target="_blank"><img src="https://img.shields.io/badge/Gmail-D14836?style=for-the-badge&logo=gmail&logoColor=white" height=30></a>
|
24
|
+
<a href="https://www.buymeacoffee.com/truocphan" target="_blank"><img src="https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black" height=30></a>
|
25
|
+
</p>
|
26
|
+
|
27
|
+
## Installation
|
28
|
+
#### From PyPI:
|
29
|
+
```console
|
30
|
+
pip install json-duplicate-keys
|
31
|
+
```
|
32
|
+
#### From Source:
|
33
|
+
```console
|
34
|
+
git clone https://github.com/truocphan/json-duplicate-keys.git --branch <Branch/Tag>
|
35
|
+
cd json-duplicate-keys
|
36
|
+
python setup.py build
|
37
|
+
python setup.py install
|
38
|
+
```
|
39
|
+
|
40
|
+
## Basic Usage
|
41
|
+
### normalize_key(`name`, `dupSign_start`="{{{", `dupSign_end`="}}}", `_isDebug_`=False)
|
42
|
+
_Normalize Key name_
|
43
|
+
- `name`: key name
|
44
|
+
- `dupSign_start`:
|
45
|
+
- `dupSign_end`:
|
46
|
+
- `_isDebug_`: Show/ Hide debug error messages
|
47
|
+
```python
|
48
|
+
import json_duplicate_keys as jdks
|
49
|
+
|
50
|
+
print(jdks.normalize_key("version{{{_2_}}}"))
|
51
|
+
# OUTPUT: version
|
52
|
+
```
|
53
|
+
---
|
54
|
+
|
55
|
+
### loads(`Jstr`, `dupSign_start`="{{{", `dupSign_end`="}}}", `ordered_dict`=False, `_isDebug_`=False)
|
56
|
+
_Deserialize a JSON format string to a class `JSON_DUPLICATE_KEYS`_
|
57
|
+
- `Jstr`: a JSON format string
|
58
|
+
- `dupSign_start`:
|
59
|
+
- `dupSign_end`:
|
60
|
+
- `ordered_dict`: preserves the order in which the Keys are inserted
|
61
|
+
- `_isDebug_`: Show/ Hide debug error messages
|
62
|
+
```python
|
63
|
+
import json_duplicate_keys as jdks
|
64
|
+
|
65
|
+
Jstr = '{"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}'
|
66
|
+
|
67
|
+
JDKSObject = jdks.loads(Jstr)
|
68
|
+
|
69
|
+
print(JDKSObject)
|
70
|
+
# OUTPUT: <json_duplicate_keys.JSON_DUPLICATE_KEYS object at 0x00000270AE987940>
|
71
|
+
```
|
72
|
+
---
|
73
|
+
|
74
|
+
### load(`Jfilepath`, `dupSign_start`="{{{", `dupSign_end`="}}}", `ordered_dict`=False, `_isDebug_`=False)
|
75
|
+
_Deserialize a JSON format string from a file to a class `JSON_DUPLICATE_KEYS`_
|
76
|
+
- `Jfilepath`: The path to the file containing the JSON format string
|
77
|
+
- `dupSign_start`:
|
78
|
+
- `dupSign_end`:
|
79
|
+
- `ordered_dict`: preserves the order in which the Keys are inserted
|
80
|
+
- `_isDebug_`: Show/ Hide debug error messages
|
81
|
+
```python
|
82
|
+
# /path/to/file.json: {"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}
|
83
|
+
|
84
|
+
import json_duplicate_keys as jdks
|
85
|
+
|
86
|
+
Jfilepath = "/path/to/file.json"
|
87
|
+
|
88
|
+
JDKSObject = jdks.load(Jfilepath)
|
89
|
+
|
90
|
+
print(JDKSObject)
|
91
|
+
# OUTPUT: <json_duplicate_keys.JSON_DUPLICATE_KEYS object at 0x00000270AE986D40>
|
92
|
+
```
|
93
|
+
---
|
94
|
+
|
95
|
+
### JSON_DUPLICATE_KEYS.getObject()
|
96
|
+
_Get the JSON object_
|
97
|
+
```python
|
98
|
+
import json_duplicate_keys as jdks
|
99
|
+
|
100
|
+
Jstr = '{"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}'
|
101
|
+
|
102
|
+
JDKSObject = jdks.loads(Jstr)
|
103
|
+
|
104
|
+
print(JDKSObject.getObject())
|
105
|
+
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest', 'release': [{'version': 'latest'}], 'snapshot': {'author': 'truocphan', 'version': '22.3.3', 'release': [{'version': 'latest'}]}}
|
106
|
+
```
|
107
|
+
---
|
108
|
+
|
109
|
+
### JSON_DUPLICATE_KEYS.get(`name`, `separator`="||", `parse_index`="$", `_isDebug_`=False)
|
110
|
+
_Get value in the JSON object by `name`_
|
111
|
+
- `name`: the key name of the JSON object. Supported flatten key name format
|
112
|
+
- `separator`:
|
113
|
+
- `parse_index`:
|
114
|
+
- `_isDebug_`: Show/ Hide debug error messages
|
115
|
+
```python
|
116
|
+
import json_duplicate_keys as jdks
|
117
|
+
|
118
|
+
Jstr = '{"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}'
|
119
|
+
|
120
|
+
JDKSObject = jdks.loads(Jstr)
|
121
|
+
|
122
|
+
print(JDKSObject.get("version{{{_2_}}}"))
|
123
|
+
# OUTPUT: latest
|
124
|
+
|
125
|
+
print(JDKSObject.get("release||$0$"))
|
126
|
+
# OUTPUT: {'version': 'latest'}
|
127
|
+
|
128
|
+
print(JDKSObject.get("snapshot||author"))
|
129
|
+
# OUTPUT: truocphan
|
130
|
+
```
|
131
|
+
---
|
132
|
+
|
133
|
+
### JSON_DUPLICATE_KEYS.set(`name`, `value`, `separator`="||", `parse_index`="$", `dupSign_start`="{{{", `dupSign_end`="}}}", `ordered_dict`=False, `_isDebug_`=False)
|
134
|
+
_Set a new `name` and `value` for the JSON object_
|
135
|
+
- `name`: new key name for the JSON object. Supported flat key name format
|
136
|
+
- `value`: value for key `name`
|
137
|
+
- `separator`:
|
138
|
+
- `parse_index`:
|
139
|
+
- `dupSign_start`:
|
140
|
+
- `dupSign_end`:
|
141
|
+
- `ordered_dict`: preserves the order in which the Keys are inserted
|
142
|
+
- `_isDebug_`: Show/Hide debug error messages
|
143
|
+
```python
|
144
|
+
import json_duplicate_keys as jdks
|
145
|
+
|
146
|
+
Jstr = '{}'
|
147
|
+
JDKSObject = jdks.loads(Jstr)
|
148
|
+
|
149
|
+
print(JDKSObject.getObject())
|
150
|
+
# OUTPUT: {}
|
151
|
+
|
152
|
+
JDKSObject.set("author", "truocphan")
|
153
|
+
print(JDKSObject.getObject())
|
154
|
+
# OUTPUT: {'author': 'truocphan'}
|
155
|
+
|
156
|
+
JDKSObject.set("version", "22.3.3")
|
157
|
+
print(JDKSObject.getObject())
|
158
|
+
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3'}
|
159
|
+
|
160
|
+
JDKSObject.set("version", "latest")
|
161
|
+
print(JDKSObject.getObject())
|
162
|
+
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest'}
|
163
|
+
|
164
|
+
JDKSObject.set("release", [{"version": "latest"}])
|
165
|
+
print(JDKSObject.getObject())
|
166
|
+
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest', 'release': [{'version': 'latest'}]}
|
167
|
+
|
168
|
+
JDKSObject.set("snapshot", {})
|
169
|
+
print(JDKSObject.getObject())
|
170
|
+
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest', 'release': [{'version': 'latest'}], 'snapshot': {}}
|
171
|
+
|
172
|
+
JDKSObject.set("snapshot||author", "truocphan")
|
173
|
+
print(JDKSObject.getObject())
|
174
|
+
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest', 'release': [{'version': 'latest'}], 'snapshot': {'author': 'truocphan'}}
|
175
|
+
|
176
|
+
|
177
|
+
Jstr = '[]'
|
178
|
+
JDKSObject = jdks.loads(Jstr)
|
179
|
+
|
180
|
+
print(JDKSObject.getObject())
|
181
|
+
# OUTPUT: []
|
182
|
+
|
183
|
+
JDKSObject.set("author", "truocphan")
|
184
|
+
print(JDKSObject.getObject())
|
185
|
+
# OUTPUT: [{'author': 'truocphan'}]
|
186
|
+
|
187
|
+
JDKSObject.set("release", [])
|
188
|
+
print(JDKSObject.getObject())
|
189
|
+
# OUTPUT: [{'author': 'truocphan'}, {'release': []}]
|
190
|
+
|
191
|
+
JDKSObject.set("$1$||release||", {"version": "latest"})
|
192
|
+
print(JDKSObject.getObject())
|
193
|
+
# OUTPUT: [{'author': 'truocphan'}, {'release': [{'version': 'latest'}]}]
|
194
|
+
```
|
195
|
+
---
|
196
|
+
|
197
|
+
### JSON_DUPLICATE_KEYS.update(`name`, `value`, `separator`="||", `parse_index`="$", `_isDebug_`=False)
|
198
|
+
_Update new `value` for existing `name` in the JSON object_
|
199
|
+
- `name`: the key name of the JSON object. Supported flatten key name format
|
200
|
+
- `value`: new value for key `name`
|
201
|
+
- `separator`:
|
202
|
+
- `parse_index`:
|
203
|
+
- `_isDebug_`: Show/ Hide debug error messages
|
204
|
+
```python
|
205
|
+
import json_duplicate_keys as jdks
|
206
|
+
|
207
|
+
Jstr = '{"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}'
|
208
|
+
|
209
|
+
JDKSObject = jdks.loads(Jstr)
|
210
|
+
|
211
|
+
print(JDKSObject.getObject())
|
212
|
+
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest', 'release': [{'version': 'latest'}], 'snapshot': {'author': 'truocphan', 'version': '22.3.3', 'release': [{'version': 'latest'}]}}
|
213
|
+
|
214
|
+
JDKSObject.update("version{{{_2_}}}", ["22.3.3", "latest"])
|
215
|
+
JDKSObject.update("snapshot||version", "latest")
|
216
|
+
|
217
|
+
print(JDKSObject.getObject())
|
218
|
+
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': ['22.3.3', 'latest'], 'release': [{'version': 'latest'}], 'snapshot': {'author': 'truocphan', 'version': 'latest', 'release': [{'version': 'latest'}]}}
|
219
|
+
```
|
220
|
+
---
|
221
|
+
|
222
|
+
### JSON_DUPLICATE_KEYS.delete(`name`, `separator`="||", `parse_index`="$", `_isDebug_`=False)
|
223
|
+
_Delete a key-value pair in a JSON object by key `name`_
|
224
|
+
- `name`: the key name of the JSON object. Supported flatten key name format
|
225
|
+
- `separator`:
|
226
|
+
- `parse_index`:
|
227
|
+
- `_isDebug_`: Show/ Hide debug error messages
|
228
|
+
```python
|
229
|
+
import json_duplicate_keys as jdks
|
230
|
+
|
231
|
+
Jstr = '{"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}'
|
232
|
+
|
233
|
+
JDKSObject = jdks.loads(Jstr)
|
234
|
+
|
235
|
+
print(JDKSObject.getObject())
|
236
|
+
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest', 'release': [{'version': 'latest'}], 'snapshot': {'author': 'truocphan', 'version': '22.3.3', 'release': [{'version': 'latest'}]}}
|
237
|
+
|
238
|
+
JDKSObject.delete("version")
|
239
|
+
JDKSObject.delete("release||$0$")
|
240
|
+
JDKSObject.delete("snapshot")
|
241
|
+
|
242
|
+
print(JDKSObject.getObject())
|
243
|
+
# OUTPUT: {'author': 'truocphan', 'version{{{_2_}}}': 'latest', 'release': []}
|
244
|
+
```
|
245
|
+
---
|
246
|
+
|
247
|
+
### JSON_DUPLICATE_KEYS.dumps(`dupSign_start`="{{{", `dupSign_end`="}}}", `_isDebug_`=False, `skipkeys`=False, `ensure_ascii`=True, `check_circular`=True, `allow_nan`=True, `cls`=None, `indent`=None, `separators`=None, `default`=None, `sort_keys`=False)
|
248
|
+
_Serialize a JSON object to a JSON format string_
|
249
|
+
- `dupSign_start`:
|
250
|
+
- `dupSign_end`:
|
251
|
+
- `_isDebug_`: Show/ Hide debug error messages
|
252
|
+
- For remaining arguments, please refer to [json.dump()](https://docs.python.org/3/library/json.html#json.dump)
|
253
|
+
```python
|
254
|
+
import json_duplicate_keys as jdks
|
255
|
+
|
256
|
+
Jstr = '{"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}'
|
257
|
+
|
258
|
+
JDKSObject = jdks.loads(Jstr)
|
259
|
+
|
260
|
+
print(JDKSObject.getObject())
|
261
|
+
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest', 'release': [{'version': 'latest'}], 'snapshot': {'author': 'truocphan', 'version': '22.3.3', 'release': [{'version': 'latest'}]}}
|
262
|
+
|
263
|
+
JDKSObject.delete("version")
|
264
|
+
JDKSObject.delete("release||$0$")
|
265
|
+
JDKSObject.delete("snapshot")
|
266
|
+
|
267
|
+
print(JDKSObject.dumps())
|
268
|
+
# OUTPUT: {"author": "truocphan", "version": "latest", "release": []}
|
269
|
+
```
|
270
|
+
---
|
271
|
+
|
272
|
+
### JSON_DUPLICATE_KEYS.dump(`Jfilepath`, `dupSign_start`="{{{", `dupSign_end`="}}}", `_isDebug_`=False, `skipkeys`=False, `ensure_ascii`=True, `check_circular`=True, `allow_nan`=True, `cls`=None, `indent`=None, `separators`=None, `default`=None, `sort_keys`=False)
|
273
|
+
_Serialize a JSON object to a JSON format string and write to a file_
|
274
|
+
- `Jfilepath`: the path to the file to save the JSON format string
|
275
|
+
- `dupSign_start`:
|
276
|
+
- `dupSign_end`:
|
277
|
+
- `_isDebug_`: Show/ Hide debug error messages
|
278
|
+
- For remaining arguments, please refer to [json.dump()](https://docs.python.org/3/library/json.html#json.dump)
|
279
|
+
```python
|
280
|
+
import json_duplicate_keys as jdks
|
281
|
+
|
282
|
+
Jstr = '{"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}'
|
283
|
+
|
284
|
+
JDKSObject = jdks.loads(Jstr)
|
285
|
+
|
286
|
+
print(JDKSObject.getObject())
|
287
|
+
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest', 'release': [{'version': 'latest'}], 'snapshot': {'author': 'truocphan', 'version': '22.3.3', 'release': [{'version': 'latest'}]}}
|
288
|
+
|
289
|
+
JDKSObject.delete("version")
|
290
|
+
JDKSObject.delete("release||$0$")
|
291
|
+
JDKSObject.delete("snapshot")
|
292
|
+
|
293
|
+
Jfilepath = "/path/to/file.json"
|
294
|
+
JDKSObject.dump(Jfilepath)
|
295
|
+
|
296
|
+
JDKSObject_load = jdks.load(Jfilepath)
|
297
|
+
print(JDKSObject_load.getObject())
|
298
|
+
# OUTPUT: {'author': 'truocphan', 'version': 'latest', 'release': []}
|
299
|
+
```
|
300
|
+
---
|
301
|
+
|
302
|
+
### JSON_DUPLICATE_KEYS.flatten(`separator`="||", `parse_index`="$", `ordered_dict`=False, `_isDebug_`=False)
|
303
|
+
_Flatten a JSON object to a single key-value pairs_
|
304
|
+
- `separator`:
|
305
|
+
- `parse_index`:
|
306
|
+
- `ordered_dict`: preserves the order in which the Keys are inserted
|
307
|
+
- `_isDebug_`: Show/ Hide debug error messages
|
308
|
+
```python
|
309
|
+
import json_duplicate_keys as jdks
|
310
|
+
|
311
|
+
Jstr = '{"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}'
|
312
|
+
|
313
|
+
JDKSObject = jdks.loads(Jstr)
|
314
|
+
|
315
|
+
print(JDKSObject.getObject())
|
316
|
+
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest', 'release': [{'version': 'latest'}], 'snapshot': {'author': 'truocphan', 'version': '22.3.3', 'release': [{'version': 'latest'}]}}
|
317
|
+
|
318
|
+
JDKSObject.flatten()
|
319
|
+
|
320
|
+
print(JDKSObject.getObject())
|
321
|
+
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest', 'release||$0$||version': 'latest', 'snapshot||author': 'truocphan', 'snapshot||version': '22.3.3', 'snapshot||release||$0$||version': 'latest'}
|
322
|
+
```
|
323
|
+
---
|
324
|
+
|
325
|
+
### JSON_DUPLICATE_KEYS.unflatten(`separator`="||", `parse_index`="$", `ordered_dict`=False, `_isDebug_`=False)
|
326
|
+
_Unflatten a flattened JSON object back to a JSON object_
|
327
|
+
- `separator`:
|
328
|
+
- `parse_index`:
|
329
|
+
- `ordered_dict`: preserves the order in which the Keys are inserted
|
330
|
+
- `_isDebug_`: Show/ Hide debug error messages
|
331
|
+
```python
|
332
|
+
import json_duplicate_keys as jdks
|
333
|
+
|
334
|
+
Jstr = '{"author": "truocphan", "version": "22.3.3", "version": "latest", "release||$0$||version": "latest", "snapshot||author": "truocphan", "snapshot||version": "22.3.3", "snapshot||release||$0$||version": "latest"}'
|
335
|
+
|
336
|
+
JDKSObject = jdks.loads(Jstr)
|
337
|
+
|
338
|
+
print(JDKSObject.getObject())
|
339
|
+
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest', 'release||$0$||version': 'latest', 'snapshot||author': 'truocphan', 'snapshot||version': '22.3.3', 'snapshot||release||$0$||version': 'latest'}
|
340
|
+
|
341
|
+
JDKSObject.unflatten()
|
342
|
+
|
343
|
+
print(JDKSObject.getObject())
|
344
|
+
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest', 'release': [{'version': 'latest'}], 'snapshot': {'author': 'truocphan', 'version': '22.3.3', 'release': [{'version': 'latest'}]}}
|
345
|
+
```
|
346
|
+
---
|
347
|
+
Keywords: json,duplicate keys,json duplicate keys,flatten,unflatten
|
348
|
+
Platform: UNKNOWN
|
349
|
+
Classifier: Programming Language :: Python :: 3
|
350
|
+
Classifier: Programming Language :: Python :: 2
|
351
|
+
Classifier: Programming Language :: Python :: Implementation :: Jython
|
352
|
+
Description-Content-Type: text/markdown
|
{json-duplicate-keys-2023.11.26 → json-duplicate-keys-2024.2.3}/json_duplicate_keys/__init__.py
RENAMED
File without changes
|
File without changes
|
@@ -1,12 +1,11 @@
|
|
1
1
|
import setuptools
|
2
|
-
import datetime
|
3
2
|
|
4
3
|
setuptools.setup(
|
5
4
|
name="json-duplicate-keys",
|
6
|
-
version=
|
7
|
-
author="
|
5
|
+
version="2024.2.3",
|
6
|
+
author="TP Cyber Security",
|
8
7
|
license="MIT",
|
9
|
-
author_email="
|
8
|
+
author_email="tpcybersec2023@gmail.com",
|
10
9
|
description="Flatten/ Unflatten and Load(s)/ Dump(s) JSON File/ Object with Duplicate Keys",
|
11
10
|
long_description=open("README.md").read(),
|
12
11
|
long_description_content_type="text/markdown",
|
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2022 Truoc Phan
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
@@ -1 +0,0 @@
|
|
1
|
-
include requirements.txt
|