json-duplicate-keys 2024.3.24__tar.gz → 2024.4.20__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.3.24/json_duplicate_keys.egg-info → json-duplicate-keys-2024.4.20}/PKG-INFO +26 -1
- {json-duplicate-keys-2024.3.24 → json-duplicate-keys-2024.4.20}/README.md +25 -0
- {json-duplicate-keys-2024.3.24 → json-duplicate-keys-2024.4.20}/json_duplicate_keys/__init__.py +31 -3
- {json-duplicate-keys-2024.3.24 → json-duplicate-keys-2024.4.20/json_duplicate_keys.egg-info}/PKG-INFO +26 -1
- {json-duplicate-keys-2024.3.24 → json-duplicate-keys-2024.4.20}/setup.py +1 -1
- {json-duplicate-keys-2024.3.24 → json-duplicate-keys-2024.4.20}/LICENSE +0 -0
- {json-duplicate-keys-2024.3.24 → json-duplicate-keys-2024.4.20}/MANIFEST.in +0 -0
- {json-duplicate-keys-2024.3.24 → json-duplicate-keys-2024.4.20}/json_duplicate_keys.egg-info/SOURCES.txt +0 -0
- {json-duplicate-keys-2024.3.24 → json-duplicate-keys-2024.4.20}/json_duplicate_keys.egg-info/dependency_links.txt +0 -0
- {json-duplicate-keys-2024.3.24 → json-duplicate-keys-2024.4.20}/json_duplicate_keys.egg-info/top_level.txt +0 -0
- {json-duplicate-keys-2024.3.24 → json-duplicate-keys-2024.4.20}/requirements.txt +0 -0
- {json-duplicate-keys-2024.3.24 → json-duplicate-keys-2024.4.20}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: json-duplicate-keys
|
3
|
-
Version: 2024.
|
3
|
+
Version: 2024.4.20
|
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
6
|
Author: TP Cyber Security
|
@@ -265,6 +265,27 @@ Description: # JSON Duplicate Keys - PyPI
|
|
265
265
|
```
|
266
266
|
---
|
267
267
|
|
268
|
+
### JSON_DUPLICATE_KEYS.filter_values(`value`, `separator`="||", `parse_index`="$", `ordered_dict`=False)
|
269
|
+
|
270
|
+
- `value`:
|
271
|
+
- `separator`:
|
272
|
+
- `parse_index`:
|
273
|
+
- `ordered_dict`:
|
274
|
+
```python
|
275
|
+
import json_duplicate_keys as jdks
|
276
|
+
|
277
|
+
Jstr = '{"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}'
|
278
|
+
|
279
|
+
JDKSObject = jdks.loads(Jstr)
|
280
|
+
|
281
|
+
print(JDKSObject.filter_values("latest").dumps())
|
282
|
+
# OUTPUT: {"version": "latest", "release||$0$||version": "latest", "snapshot||release||$0$||version": "latest"}
|
283
|
+
|
284
|
+
print(JDKSObject.dumps())
|
285
|
+
# OUTPUT: {"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}
|
286
|
+
```
|
287
|
+
---
|
288
|
+
|
268
289
|
### 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)
|
269
290
|
_Serialize a JSON object to a JSON format string_
|
270
291
|
- `dupSign_start`:
|
@@ -367,6 +388,10 @@ Description: # JSON Duplicate Keys - PyPI
|
|
367
388
|
---
|
368
389
|
|
369
390
|
## CHANGELOG
|
391
|
+
#### [json-duplicate-keys v2024.4.20](https://github.com/truocphan/json-duplicate-keys/tree/2024.4.20)
|
392
|
+
- **New**: _filter_values_
|
393
|
+
- **Updated**: _filter_keys_
|
394
|
+
|
370
395
|
#### [json-duplicate-keys v2024.3.24](https://github.com/truocphan/json-duplicate-keys/tree/2024.3.24)
|
371
396
|
- **Updated**: _normalize_key_, _loads_, _get_, _set_, _update_, _delete_
|
372
397
|
---
|
@@ -257,6 +257,27 @@ print(JDKSObject.dumps())
|
|
257
257
|
```
|
258
258
|
---
|
259
259
|
|
260
|
+
### JSON_DUPLICATE_KEYS.filter_values(`value`, `separator`="||", `parse_index`="$", `ordered_dict`=False)
|
261
|
+
|
262
|
+
- `value`:
|
263
|
+
- `separator`:
|
264
|
+
- `parse_index`:
|
265
|
+
- `ordered_dict`:
|
266
|
+
```python
|
267
|
+
import json_duplicate_keys as jdks
|
268
|
+
|
269
|
+
Jstr = '{"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}'
|
270
|
+
|
271
|
+
JDKSObject = jdks.loads(Jstr)
|
272
|
+
|
273
|
+
print(JDKSObject.filter_values("latest").dumps())
|
274
|
+
# OUTPUT: {"version": "latest", "release||$0$||version": "latest", "snapshot||release||$0$||version": "latest"}
|
275
|
+
|
276
|
+
print(JDKSObject.dumps())
|
277
|
+
# OUTPUT: {"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}
|
278
|
+
```
|
279
|
+
---
|
280
|
+
|
260
281
|
### 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)
|
261
282
|
_Serialize a JSON object to a JSON format string_
|
262
283
|
- `dupSign_start`:
|
@@ -359,6 +380,10 @@ print(JDKSObject.getObject())
|
|
359
380
|
---
|
360
381
|
|
361
382
|
## CHANGELOG
|
383
|
+
#### [json-duplicate-keys v2024.4.20](https://github.com/truocphan/json-duplicate-keys/tree/2024.4.20)
|
384
|
+
- **New**: _filter_values_
|
385
|
+
- **Updated**: _filter_keys_
|
386
|
+
|
362
387
|
#### [json-duplicate-keys v2024.3.24](https://github.com/truocphan/json-duplicate-keys/tree/2024.3.24)
|
363
388
|
- **Updated**: _normalize_key_, _loads_, _get_, _set_, _update_, _delete_
|
364
389
|
---
|
{json-duplicate-keys-2024.3.24 → json-duplicate-keys-2024.4.20}/json_duplicate_keys/__init__.py
RENAMED
@@ -454,9 +454,37 @@ class JSON_DUPLICATE_KEYS:
|
|
454
454
|
JDKSObject.flatten(separator=separator, parse_index=parse_index, ordered_dict=ordered_dict)
|
455
455
|
newJDKSObject = loads("{}", ordered_dict=ordered_dict)
|
456
456
|
|
457
|
-
for k in JDKSObject.getObject():
|
458
|
-
if
|
459
|
-
|
457
|
+
for k, v in JDKSObject.getObject().items():
|
458
|
+
if type(k) == str and type(name) == str:
|
459
|
+
if re.search(name, k):
|
460
|
+
newJDKSObject.set(k, v, separator="§§"+separator+"§§", parse_index="§§"+parse_index+"§§", ordered_dict=ordered_dict)
|
461
|
+
else:
|
462
|
+
if name == k:
|
463
|
+
newJDKSObject.set(k, v, separator="§§"+separator+"§§", parse_index="§§"+parse_index+"§§", ordered_dict=ordered_dict)
|
464
|
+
|
465
|
+
return newJDKSObject
|
466
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
467
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
468
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
469
|
+
|
470
|
+
|
471
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
472
|
+
# # # # # # # # # # # # filter_values # # # # # # # # # # # # #
|
473
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
474
|
+
def filter_values(self, value, separator="||", parse_index="$", ordered_dict=False):
|
475
|
+
import re, copy
|
476
|
+
|
477
|
+
JDKSObject = copy.deepcopy(self)
|
478
|
+
JDKSObject.flatten(separator=separator, parse_index=parse_index, ordered_dict=ordered_dict)
|
479
|
+
newJDKSObject = loads("{}", ordered_dict=ordered_dict)
|
480
|
+
|
481
|
+
for k, v in JDKSObject.getObject().items():
|
482
|
+
if type(v) == str and type(value) == str:
|
483
|
+
if re.search(value, v):
|
484
|
+
newJDKSObject.set(k, v, separator="§§"+separator+"§§", parse_index="§§"+parse_index+"§§", ordered_dict=ordered_dict)
|
485
|
+
else:
|
486
|
+
if value == v:
|
487
|
+
newJDKSObject.set(k, v, separator="§§"+separator+"§§", parse_index="§§"+parse_index+"§§", ordered_dict=ordered_dict)
|
460
488
|
|
461
489
|
return newJDKSObject
|
462
490
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: json-duplicate-keys
|
3
|
-
Version: 2024.
|
3
|
+
Version: 2024.4.20
|
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
6
|
Author: TP Cyber Security
|
@@ -265,6 +265,27 @@ Description: # JSON Duplicate Keys - PyPI
|
|
265
265
|
```
|
266
266
|
---
|
267
267
|
|
268
|
+
### JSON_DUPLICATE_KEYS.filter_values(`value`, `separator`="||", `parse_index`="$", `ordered_dict`=False)
|
269
|
+
|
270
|
+
- `value`:
|
271
|
+
- `separator`:
|
272
|
+
- `parse_index`:
|
273
|
+
- `ordered_dict`:
|
274
|
+
```python
|
275
|
+
import json_duplicate_keys as jdks
|
276
|
+
|
277
|
+
Jstr = '{"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}'
|
278
|
+
|
279
|
+
JDKSObject = jdks.loads(Jstr)
|
280
|
+
|
281
|
+
print(JDKSObject.filter_values("latest").dumps())
|
282
|
+
# OUTPUT: {"version": "latest", "release||$0$||version": "latest", "snapshot||release||$0$||version": "latest"}
|
283
|
+
|
284
|
+
print(JDKSObject.dumps())
|
285
|
+
# OUTPUT: {"author": "truocphan", "version": "22.3.3", "version": "latest", "release": [{"version": "latest"}], "snapshot": {"author": "truocphan", "version": "22.3.3", "release": [{"version": "latest"}]}}
|
286
|
+
```
|
287
|
+
---
|
288
|
+
|
268
289
|
### 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)
|
269
290
|
_Serialize a JSON object to a JSON format string_
|
270
291
|
- `dupSign_start`:
|
@@ -367,6 +388,10 @@ Description: # JSON Duplicate Keys - PyPI
|
|
367
388
|
---
|
368
389
|
|
369
390
|
## CHANGELOG
|
391
|
+
#### [json-duplicate-keys v2024.4.20](https://github.com/truocphan/json-duplicate-keys/tree/2024.4.20)
|
392
|
+
- **New**: _filter_values_
|
393
|
+
- **Updated**: _filter_keys_
|
394
|
+
|
370
395
|
#### [json-duplicate-keys v2024.3.24](https://github.com/truocphan/json-duplicate-keys/tree/2024.3.24)
|
371
396
|
- **Updated**: _normalize_key_, _loads_, _get_, _set_, _update_, _delete_
|
372
397
|
---
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|