json-duplicate-keys 2023.11.26__py3-none-any.whl → 2024.2.21__py3-none-any.whl
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/__init__.py +20 -0
- {json_duplicate_keys-2023.11.26.dist-info → json_duplicate_keys-2024.2.21.dist-info}/LICENSE +1 -1
- {json_duplicate_keys-2023.11.26.dist-info → json_duplicate_keys-2024.2.21.dist-info}/METADATA +29 -8
- json_duplicate_keys-2024.2.21.dist-info/RECORD +6 -0
- json_duplicate_keys-2023.11.26.dist-info/RECORD +0 -6
- {json_duplicate_keys-2023.11.26.dist-info → json_duplicate_keys-2024.2.21.dist-info}/WHEEL +0 -0
- {json_duplicate_keys-2023.11.26.dist-info → json_duplicate_keys-2024.2.21.dist-info}/top_level.txt +0 -0
json_duplicate_keys/__init__.py
CHANGED
@@ -444,6 +444,26 @@ class JSON_DUPLICATE_KEYS:
|
|
444
444
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
445
445
|
|
446
446
|
|
447
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
448
|
+
# # # # # # # # # # # # filter_keys # # # # # # # # # # # # #
|
449
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
450
|
+
def filter_keys(self, name, separator="||", parse_index="$", ordered_dict=False):
|
451
|
+
import re, copy
|
452
|
+
|
453
|
+
JDKSObject = copy.deepcopy(self)
|
454
|
+
JDKSObject.flatten(separator=separator, parse_index=parse_index, ordered_dict=ordered_dict)
|
455
|
+
newJDKSObject = loads("{}", ordered_dict=ordered_dict)
|
456
|
+
|
457
|
+
for k in JDKSObject.getObject():
|
458
|
+
if re.search(name, k):
|
459
|
+
newJDKSObject.set(k, JDKSObject.get(k, separator="§§"+separator+"§§", parse_index="§§"+parse_index+"§§"), separator="§§"+separator+"§§", parse_index="§§"+parse_index+"§§", ordered_dict=ordered_dict)
|
460
|
+
|
461
|
+
return newJDKSObject
|
462
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
463
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
464
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
465
|
+
|
466
|
+
|
447
467
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
448
468
|
# # # # # # # # # # # # # # dumps # # # # # # # # # # # # # #
|
449
469
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
{json_duplicate_keys-2023.11.26.dist-info → json_duplicate_keys-2024.2.21.dist-info}/METADATA
RENAMED
@@ -1,12 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: json-duplicate-keys
|
3
|
-
Version:
|
3
|
+
Version: 2024.2.21
|
4
4
|
Summary: Flatten/ Unflatten and Load(s)/ Dump(s) JSON File/ Object with Duplicate Keys
|
5
5
|
Home-page: https://github.com/truocphan/json-duplicate-keys
|
6
|
-
Author:
|
7
|
-
Author-email:
|
6
|
+
Author: TP Cyber Security
|
7
|
+
Author-email: tpcybersec2023@gmail.com
|
8
8
|
License: MIT
|
9
|
-
Keywords: json,duplicate keys,json duplicate keys,flatten,unflatten
|
9
|
+
Keywords: TPCyberSec,json,duplicate keys,json duplicate keys,flatten,unflatten
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
11
11
|
Classifier: Programming Language :: Python :: 2
|
12
12
|
Classifier: Programming Language :: Python :: Implementation :: Jython
|
@@ -24,10 +24,10 @@ Flatten/ Unflatten and Load(s)/ Dump(s) JSON File/ Object with Duplicate Keys
|
|
24
24
|
<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>
|
25
25
|
<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>
|
26
26
|
<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>
|
27
|
-
<a href="https://www.facebook.com/
|
28
|
-
<a href="https://twitter.com/
|
27
|
+
<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>
|
28
|
+
<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>
|
29
29
|
<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>
|
30
|
-
<a href="mailto:
|
30
|
+
<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>
|
31
31
|
<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>
|
32
32
|
</p>
|
33
33
|
|
@@ -38,7 +38,7 @@ pip install json-duplicate-keys
|
|
38
38
|
```
|
39
39
|
#### From Source:
|
40
40
|
```console
|
41
|
-
git clone https://github.com/truocphan/json-duplicate-keys.git
|
41
|
+
git clone https://github.com/truocphan/json-duplicate-keys.git --branch <Branch/Tag>
|
42
42
|
cd json-duplicate-keys
|
43
43
|
python setup.py build
|
44
44
|
python setup.py install
|
@@ -251,6 +251,27 @@ print(JDKSObject.getObject())
|
|
251
251
|
```
|
252
252
|
---
|
253
253
|
|
254
|
+
### JSON_DUPLICATE_KEYS.filter_keys(`name`, `separator`="||", `parse_index`="$", `ordered_dict`=False)
|
255
|
+
|
256
|
+
- `name`:
|
257
|
+
- `separator`:
|
258
|
+
- `parse_index`:
|
259
|
+
- `ordered_dict`:
|
260
|
+
```python
|
261
|
+
import json_duplicate_keys as jdks
|
262
|
+
|
263
|
+
Jstr = '{"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}'
|
264
|
+
|
265
|
+
JDKSObject = jdks.loads(Jstr)
|
266
|
+
|
267
|
+
print(JDKSObject.filter_keys("version").dumps())
|
268
|
+
# OUTPUT: {"version": "22.3.3", "version": "latest", "release||$0$||version": "latest", "snapshot||version": "22.3.3", "snapshot||release||$0$||version": "latest"}
|
269
|
+
|
270
|
+
print(JDKSObject.dumps())
|
271
|
+
# OUTPUT: {"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}
|
272
|
+
```
|
273
|
+
---
|
274
|
+
|
254
275
|
### 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)
|
255
276
|
_Serialize a JSON object to a JSON format string_
|
256
277
|
- `dupSign_start`:
|
@@ -0,0 +1,6 @@
|
|
1
|
+
json_duplicate_keys/__init__.py,sha256=S3Pnw-ckvgau80EFED0X3p1y40eZBZ1Uo1dkl6MaEW0,28666
|
2
|
+
json_duplicate_keys-2024.2.21.dist-info/LICENSE,sha256=_hudSGMciUc27wGR8EMKfeb3atJRlf6rbhJtLnel-nc,1093
|
3
|
+
json_duplicate_keys-2024.2.21.dist-info/METADATA,sha256=5x3y0xFTSmMK7eW8BuJdcM3ZzxjQggN2O1bYn3HMR4I,16956
|
4
|
+
json_duplicate_keys-2024.2.21.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
|
5
|
+
json_duplicate_keys-2024.2.21.dist-info/top_level.txt,sha256=vdsGrPLVS_l-BFL1i4hCJBY5_-gq4Cwp-11yegA750Y,20
|
6
|
+
json_duplicate_keys-2024.2.21.dist-info/RECORD,,
|
@@ -1,6 +0,0 @@
|
|
1
|
-
json_duplicate_keys/__init__.py,sha256=s9y6GXxwLvhQ_r1IPDDL71KI6FjqdbULprrha6E5uzI,27662
|
2
|
-
json_duplicate_keys-2023.11.26.dist-info/LICENSE,sha256=2FPBErdMhPfKiIloQFq05GmF_cLhSJIqrgk5s_zraz8,1086
|
3
|
-
json_duplicate_keys-2023.11.26.dist-info/METADATA,sha256=wGkMhOAsopMWmjGPWXTdvrO6Su__my2LTDcIjPGYmGE,15996
|
4
|
-
json_duplicate_keys-2023.11.26.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
|
5
|
-
json_duplicate_keys-2023.11.26.dist-info/top_level.txt,sha256=vdsGrPLVS_l-BFL1i4hCJBY5_-gq4Cwp-11yegA750Y,20
|
6
|
-
json_duplicate_keys-2023.11.26.dist-info/RECORD,,
|
File without changes
|
{json_duplicate_keys-2023.11.26.dist-info → json_duplicate_keys-2024.2.21.dist-info}/top_level.txt
RENAMED
File without changes
|