@@ -30,8 +30,8 @@ python setup.py install
30
30
### normalize_key(` name ` , ` dupSign_start ` ="{{{", ` dupSign_end ` ="}}}", ` _isDebug_ ` =False)
31
31
_ Normalize Key name_
32
32
- ` 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: ` }}} ` )
35
35
- ` _isDebug_ ` : Show/ Hide debug error messages
36
36
``` python
37
37
import json_duplicate_keys as jdks
@@ -44,8 +44,8 @@ print(jdks.normalize_key("version{{{_2_}}}"))
44
44
### loads(` Jstr ` , ` dupSign_start ` ="{{{", ` dupSign_end ` ="}}}", ` ordered_dict ` =False, ` skipDuplicated ` =False, ` _isDebug_ ` =False)
45
45
_ Deserialize a JSON format string to a class ` JSON_DUPLICATE_KEYS ` _
46
46
- ` 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: ` }}} ` )
49
49
- ` ordered_dict ` : preserves the order in which the Keys are inserted
50
50
- ` skipDuplicated ` : Skip loading duplicate keys to improve execution performance
51
51
- ` _isDebug_ ` : Show/ Hide debug error messages
@@ -64,8 +64,8 @@ print(JDKSObject)
64
64
### load(` Jfilepath ` , ` dupSign_start ` ="{{{", ` dupSign_end ` ="}}}", ` ordered_dict ` =False, ` skipDuplicated ` =False, ` _isDebug_ ` =False)
65
65
_ Deserialize a JSON format string from a file to a class ` JSON_DUPLICATE_KEYS ` _
66
66
- ` 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: ` }}} ` )
69
69
- ` ordered_dict ` : preserves the order in which the Keys are inserted
70
70
- ` skipDuplicated ` : Skip loading duplicate keys to improve execution performance
71
71
- ` _isDebug_ ` : Show/ Hide debug error messages
@@ -101,8 +101,8 @@ print(JDKSObject.getObject())
101
101
_ Get value in the JSON object by ` name ` _
102
102
- ` name ` : the key name of the JSON object. Supported flatten key name format
103
103
- ` 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: ` $ ` )
106
106
- ` _isDebug_ ` : Show/ Hide debug error messages
107
107
``` python
108
108
import json_duplicate_keys as jdks
@@ -127,10 +127,10 @@ _Set a new `name` and `value` for the JSON object_
127
127
- ` name ` : new key name for the JSON object. Supported flat key name format
128
128
- ` value ` : value for key ` name `
129
129
- ` 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: ` }}} ` )
134
134
- ` ordered_dict ` : preserves the order in which the Keys are inserted
135
135
- ` _isDebug_ ` : Show/Hide debug error messages
136
136
``` python
@@ -165,25 +165,6 @@ print(JDKSObject.getObject())
165
165
JDKSObject.set(" snapshot||author" , " truocphan" )
166
166
print (JDKSObject.getObject())
167
167
# 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'}]}]
187
168
```
188
169
---
189
170
@@ -193,10 +174,10 @@ _Insert `value` at `position` in value list of `name`_
193
174
- ` value ` : new value for key ` name `
194
175
- ` position ` : position of the ` value ` to insert (default insert at the last position of the list)
195
176
- ` 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: ` }}} ` )
200
181
- ` _isDebug_ ` : Show/ Hide debug error messages
201
182
``` python
202
183
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_
222
203
- ` value ` : new value for key ` name `
223
204
- ` case_insensitive ` : the key name case (in)sensitive
224
205
- ` 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: ` }}} ` )
229
210
- ` ordered_dict ` : preserves the order in which the Keys are inserted
230
211
- ` _isDebug_ ` : Show/ Hide debug error messages
231
212
``` python
@@ -250,8 +231,8 @@ print(JDKSObject.getObject())
250
231
_ Delete a key-value pair in a JSON object by key ` name ` _
251
232
- ` name ` : the key name of the JSON object. Supported flatten key name format
252
233
- ` 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: ` $ ` )
255
236
- ` _isDebug_ ` : Show/ Hide debug error messages
256
237
``` python
257
238
import json_duplicate_keys as jdks
@@ -273,10 +254,10 @@ print(JDKSObject.getObject())
273
254
---
274
255
275
256
### 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 _
277
258
- ` name ` :
278
- - ` separator ` :
279
- - ` parse_index ` :
259
+ - ` separator ` : Separator for flatten keys (default: ` || ` )
260
+ - ` parse_index ` : Symbol for index parsing (default: ` $ ` )
280
261
- ` ordered_dict ` : preserves the order in which the Keys are inserted
281
262
``` python
282
263
import json_duplicate_keys as jdks
@@ -294,10 +275,10 @@ print(JDKSObject.dumps())
294
275
---
295
276
296
277
### 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 _
298
279
- ` value ` :
299
- - ` separator ` :
300
- - ` parse_index ` :
280
+ - ` separator ` : Separator for flatten keys (default: ` || ` )
281
+ - ` parse_index ` : Symbol for index parsing (default: ` $ ` )
301
282
- ` ordered_dict ` : preserves the order in which the Keys are inserted
302
283
``` python
303
284
import json_duplicate_keys as jdks
@@ -316,8 +297,8 @@ print(JDKSObject.dumps())
316
297
317
298
### 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)
318
299
_ 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: ` }}} ` )
321
302
- ` _isDebug_ ` : Show/ Hide debug error messages
322
303
- For remaining arguments, please refer to [ json.dump()] ( https://docs.python.org/3/library/json.html#json.dump )
323
304
``` python
@@ -342,8 +323,8 @@ print(JDKSObject.dumps())
342
323
### 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)
343
324
_ Serialize a JSON object to a JSON format string and write to a file_
344
325
- ` 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: ` }}} ` )
347
328
- ` _isDebug_ ` : Show/ Hide debug error messages
348
329
- For remaining arguments, please refer to [ json.dump()] ( https://docs.python.org/3/library/json.html#json.dump )
349
330
``` python
@@ -371,8 +352,8 @@ print(JDKSObject_load.getObject())
371
352
372
353
### JSON_DUPLICATE_KEYS.flatten(` separator ` ="||", ` parse_index ` ="$", ` ordered_dict ` =False, ` _isDebug_ ` =False)
373
354
_ 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: ` $ ` )
376
357
- ` ordered_dict ` : preserves the order in which the Keys are inserted
377
358
- ` _isDebug_ ` : Show/ Hide debug error messages
378
359
``` python
@@ -394,8 +375,8 @@ print(JDKSObject.getObject())
394
375
395
376
### JSON_DUPLICATE_KEYS.unflatten(` separator ` ="||", ` parse_index ` ="$", ` ordered_dict ` =False, ` _isDebug_ ` =False)
396
377
_ 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: ` $ ` )
399
380
- ` ordered_dict ` : preserves the order in which the Keys are inserted
400
381
- ` _isDebug_ ` : Show/ Hide debug error messages
401
382
``` python
@@ -416,6 +397,11 @@ print(JDKSObject.getObject())
416
397
---
417
398
418
399
## 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
+
419
405
#### [ json-duplicate-keys v2025.6.6] ( https://github.com/truocphan/json-duplicate-keys/tree/2025.6.6 )
420
406
- [ ** Updated** ] Added ` skipDuplicated ` parameter to ` load ` and ` loads ` functions to improve performance when parsing large JSON strings by skipping duplicate keys.
421
407
0 commit comments