Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit 37d13fc

Browse files
committed
Released json-duplicate-keys v2025.7.1
1 parent fec12fd commit 37d13fc

File tree

3 files changed

+110
-94
lines changed

3 files changed

+110
-94
lines changed

README.md

Lines changed: 41 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ python setup.py install
3030
### normalize_key(`name`, `dupSign_start`="{{{", `dupSign_end`="}}}", `_isDebug_`=False)
3131
_Normalize Key name_
3232
- `name`: key name
33-
- `dupSign_start`:
34-
- `dupSign_end`:
33+
- `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
34+
- `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
3535
- `_isDebug_`: Show/ Hide debug error messages
3636
```python
3737
import json_duplicate_keys as jdks
@@ -44,8 +44,8 @@ print(jdks.normalize_key("version{{{_2_}}}"))
4444
### loads(`Jstr`, `dupSign_start`="{{{", `dupSign_end`="}}}", `ordered_dict`=False, `skipDuplicated`=False, `_isDebug_`=False)
4545
_Deserialize a JSON format string to a class `JSON_DUPLICATE_KEYS`_
4646
- `Jstr`: a JSON format string
47-
- `dupSign_start`:
48-
- `dupSign_end`:
47+
- `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
48+
- `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
4949
- `ordered_dict`: preserves the order in which the Keys are inserted
5050
- `skipDuplicated`: Skip loading duplicate keys to improve execution performance
5151
- `_isDebug_`: Show/ Hide debug error messages
@@ -64,8 +64,8 @@ print(JDKSObject)
6464
### load(`Jfilepath`, `dupSign_start`="{{{", `dupSign_end`="}}}", `ordered_dict`=False, `skipDuplicated`=False, `_isDebug_`=False)
6565
_Deserialize a JSON format string from a file to a class `JSON_DUPLICATE_KEYS`_
6666
- `Jfilepath`: The path to the file containing the JSON format string
67-
- `dupSign_start`:
68-
- `dupSign_end`:
67+
- `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
68+
- `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
6969
- `ordered_dict`: preserves the order in which the Keys are inserted
7070
- `skipDuplicated`: Skip loading duplicate keys to improve execution performance
7171
- `_isDebug_`: Show/ Hide debug error messages
@@ -101,8 +101,8 @@ print(JDKSObject.getObject())
101101
_Get value in the JSON object by `name`_
102102
- `name`: the key name of the JSON object. Supported flatten key name format
103103
- `case_insensitive`: the key name case (in)sensitive
104-
- `separator`:
105-
- `parse_index`:
104+
- `separator`: Separator for flatten keys (default: `||`)
105+
- `parse_index`: Symbol for index parsing (default: `$`)
106106
- `_isDebug_`: Show/ Hide debug error messages
107107
```python
108108
import json_duplicate_keys as jdks
@@ -127,10 +127,10 @@ _Set a new `name` and `value` for the JSON object_
127127
- `name`: new key name for the JSON object. Supported flat key name format
128128
- `value`: value for key `name`
129129
- `case_insensitive`: the key name case (in)sensitive
130-
- `separator`:
131-
- `parse_index`:
132-
- `dupSign_start`:
133-
- `dupSign_end`:
130+
- `separator`: Separator for flatten keys (default: `||`)
131+
- `parse_index`: Symbol for index parsing (default: `$`)
132+
- `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
133+
- `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
134134
- `ordered_dict`: preserves the order in which the Keys are inserted
135135
- `_isDebug_`: Show/Hide debug error messages
136136
```python
@@ -165,25 +165,6 @@ print(JDKSObject.getObject())
165165
JDKSObject.set("snapshot||author", "truocphan")
166166
print(JDKSObject.getObject())
167167
# OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest', 'release': [{'version': 'latest'}], 'snapshot': {'author': 'truocphan'}}
168-
169-
170-
Jstr = '[]'
171-
JDKSObject = jdks.loads(Jstr)
172-
173-
print(JDKSObject.getObject())
174-
# OUTPUT: []
175-
176-
JDKSObject.set("author", "truocphan")
177-
print(JDKSObject.getObject())
178-
# OUTPUT: [{'author': 'truocphan'}]
179-
180-
JDKSObject.set("release", [])
181-
print(JDKSObject.getObject())
182-
# OUTPUT: [{'author': 'truocphan'}, {'release': []}]
183-
184-
JDKSObject.set("$1$||release||", {"version": "latest"})
185-
print(JDKSObject.getObject())
186-
# OUTPUT: [{'author': 'truocphan'}, {'release': [{'version': 'latest'}]}]
187168
```
188169
---
189170

@@ -193,10 +174,10 @@ _Insert `value` at `position` in value list of `name`_
193174
- `value`: new value for key `name`
194175
- `position`: position of the `value` to insert (default insert at the last position of the list)
195176
- `case_insensitive`: the key name case (in)sensitive
196-
- `separator`:
197-
- `parse_index`:
198-
- `dupSign_start`:
199-
- `dupSign_end`:
177+
- `separator`: Separator for flatten keys (default: `||`)
178+
- `parse_index`: Symbol for index parsing (default: `$`)
179+
- `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
180+
- `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
200181
- `_isDebug_`: Show/ Hide debug error messages
201182
```python
202183
import json_duplicate_keys as jdks
@@ -222,10 +203,10 @@ _Update new `value` for existing `name` or Set a new `name` in the JSON object_
222203
- `value`: new value for key `name`
223204
- `case_insensitive`: the key name case (in)sensitive
224205
- `allow_new_key`: allows to create a new key name if the key name does not exist
225-
- `separator`:
226-
- `parse_index`:
227-
- `dupSign_start`:
228-
- `dupSign_end`:
206+
- `separator`: Separator for flatten keys (default: `||`)
207+
- `parse_index`: Symbol for index parsing (default: `$`)
208+
- `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
209+
- `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
229210
- `ordered_dict`: preserves the order in which the Keys are inserted
230211
- `_isDebug_`: Show/ Hide debug error messages
231212
```python
@@ -250,8 +231,8 @@ print(JDKSObject.getObject())
250231
_Delete a key-value pair in a JSON object by key `name`_
251232
- `name`: the key name of the JSON object. Supported flatten key name format
252233
- `case_insensitive`: the key name case (in)sensitive
253-
- `separator`:
254-
- `parse_index`:
234+
- `separator`: Separator for flatten keys (default: `||`)
235+
- `parse_index`: Symbol for index parsing (default: `$`)
255236
- `_isDebug_`: Show/ Hide debug error messages
256237
```python
257238
import json_duplicate_keys as jdks
@@ -273,10 +254,10 @@ print(JDKSObject.getObject())
273254
---
274255

275256
### JSON_DUPLICATE_KEYS.filter_keys(`name`, `separator`="||", `parse_index`="$", `ordered_dict`=False)
276-
257+
_Return a `JSON_DUPLICATE_KEYS` object with keys matching a pattern_
277258
- `name`:
278-
- `separator`:
279-
- `parse_index`:
259+
- `separator`: Separator for flatten keys (default: `||`)
260+
- `parse_index`: Symbol for index parsing (default: `$`)
280261
- `ordered_dict`: preserves the order in which the Keys are inserted
281262
```python
282263
import json_duplicate_keys as jdks
@@ -294,10 +275,10 @@ print(JDKSObject.dumps())
294275
---
295276

296277
### JSON_DUPLICATE_KEYS.filter_values(`value`, `separator`="||", `parse_index`="$", `ordered_dict`=False)
297-
278+
_Return a `JSON_DUPLICATE_KEYS` object with values matching a pattern_
298279
- `value`:
299-
- `separator`:
300-
- `parse_index`:
280+
- `separator`: Separator for flatten keys (default: `||`)
281+
- `parse_index`: Symbol for index parsing (default: `$`)
301282
- `ordered_dict`: preserves the order in which the Keys are inserted
302283
```python
303284
import json_duplicate_keys as jdks
@@ -316,8 +297,8 @@ print(JDKSObject.dumps())
316297

317298
### 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)
318299
_Serialize a JSON object to a JSON format string_
319-
- `dupSign_start`:
320-
- `dupSign_end`:
300+
- `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
301+
- `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
321302
- `_isDebug_`: Show/ Hide debug error messages
322303
- For remaining arguments, please refer to [json.dump()](https://docs.python.org/3/library/json.html#json.dump)
323304
```python
@@ -342,8 +323,8 @@ print(JDKSObject.dumps())
342323
### 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)
343324
_Serialize a JSON object to a JSON format string and write to a file_
344325
- `Jfilepath`: the path to the file to save the JSON format string
345-
- `dupSign_start`:
346-
- `dupSign_end`:
326+
- `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
327+
- `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
347328
- `_isDebug_`: Show/ Hide debug error messages
348329
- For remaining arguments, please refer to [json.dump()](https://docs.python.org/3/library/json.html#json.dump)
349330
```python
@@ -371,8 +352,8 @@ print(JDKSObject_load.getObject())
371352

372353
### JSON_DUPLICATE_KEYS.flatten(`separator`="||", `parse_index`="$", `ordered_dict`=False, `_isDebug_`=False)
373354
_Flatten a JSON object to a single key-value pairs_
374-
- `separator`:
375-
- `parse_index`:
355+
- `separator`: Separator for flatten keys (default: `||`)
356+
- `parse_index`: Symbol for index parsing (default: `$`)
376357
- `ordered_dict`: preserves the order in which the Keys are inserted
377358
- `_isDebug_`: Show/ Hide debug error messages
378359
```python
@@ -394,8 +375,8 @@ print(JDKSObject.getObject())
394375

395376
### JSON_DUPLICATE_KEYS.unflatten(`separator`="||", `parse_index`="$", `ordered_dict`=False, `_isDebug_`=False)
396377
_Unflatten a flattened JSON object back to a JSON object_
397-
- `separator`:
398-
- `parse_index`:
378+
- `separator`: Separator for flatten keys (default: `||`)
379+
- `parse_index`: Symbol for index parsing (default: `$`)
399380
- `ordered_dict`: preserves the order in which the Keys are inserted
400381
- `_isDebug_`: Show/ Hide debug error messages
401382
```python
@@ -416,6 +397,11 @@ print(JDKSObject.getObject())
416397
---
417398

418399
## CHANGELOG
400+
#### [json-duplicate-keys v2025.7.1](https://github.com/truocphan/json-duplicate-keys/tree/2025.7.1)
401+
- [**Updated**] Fixed some issues when loading JSON strings with `skipDuplicated` option
402+
- [**Updated**] Allow loading of JSON data in byte string format
403+
- [**Updated**] Issue with getting and setting an empty list
404+
419405
#### [json-duplicate-keys v2025.6.6](https://github.com/truocphan/json-duplicate-keys/tree/2025.6.6)
420406
- [**Updated**] Added `skipDuplicated` parameter to `load` and `loads` functions to improve performance when parsing large JSON strings by skipping duplicate keys.
421407

build.cmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
python -m pip install "setuptools<70"
12
python setup.py bdist_wheel sdist
23
twine upload --skip-existing dist/*

0 commit comments

Comments
 (0)