json-duplicate-keys 2024.12.12__py3-none-any.whl → 2025.7.1__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.
@@ -1,4 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
+ json_duplicate_keys_VERSION = "2025.7.1"
3
+
2
4
  try:
3
5
  unicode # Python 2
4
6
  except NameError:
@@ -31,14 +33,16 @@ def normalize_key(name, dupSign_start="{{{", dupSign_end="}}}", _isDebug_=False)
31
33
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
32
34
  # # # # # # # # # # # # # # # loads # # # # # # # # # # # # # #
33
35
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
34
- def loads(Jstr, dupSign_start="{{{", dupSign_end="}}}", ordered_dict=False, _isDebug_=False):
36
+ def loads(Jstr, dupSign_start="{{{", dupSign_end="}}}", ordered_dict=False, skipDuplicated=False, _isDebug_=False):
35
37
  # User input data type validation
36
38
  if type(_isDebug_) != bool: _isDebug_ = False
37
39
 
40
+ if type(skipDuplicated) != bool: skipDuplicated = False
41
+
38
42
  if type(ordered_dict) != bool: ordered_dict = False
39
43
 
40
- if type(Jstr) not in [str, unicode]:
41
- if _isDebug_: print("\x1b[31m[-] DataTypeError: the JSON object must be str or unicode, not {}\x1b[0m".format(type(Jstr)))
44
+ if type(Jstr) not in [str, unicode, bytes]:
45
+ if _isDebug_: print("\x1b[31m[-] DataTypeError: the JSON object must be str, unicode or bytes, not {}\x1b[0m".format(type(Jstr)))
42
46
  return False
43
47
 
44
48
  if type(dupSign_start) not in [str, unicode]: dupSign_start = "{{{"
@@ -93,6 +97,13 @@ def loads(Jstr, dupSign_start="{{{", dupSign_end="}}}", ordered_dict=False, _isD
93
97
  Jloads = json.loads(Jstr)
94
98
  if ordered_dict: Jloads = json.loads(Jstr, object_pairs_hook=OrderedDict)
95
99
 
100
+ if skipDuplicated:
101
+ if type(Jloads) in [list, dict, OrderedDict]:
102
+ return JSON_DUPLICATE_KEYS(Jloads)
103
+ else:
104
+ if _isDebug_: print("\x1b[31m[-] DataError: Invalid JSON format\x1b[0m")
105
+ return False
106
+
96
107
  if type(Jloads) in [list, dict, OrderedDict]:
97
108
  dupSign_start_escape = "".join(["\\\\u"+hex(ord(c))[2:].zfill(4) for c in dupSign_start])
98
109
  dupSign_start_escape_regex = re.escape(dupSign_start)
@@ -101,23 +112,41 @@ def loads(Jstr, dupSign_start="{{{", dupSign_end="}}}", ordered_dict=False, _isD
101
112
  dupSign_end_escape_regex = re.escape(dupSign_end)
102
113
 
103
114
 
104
- Jstr = re.sub(r'\\\\', '\x00\x01', Jstr)
105
- Jstr = re.sub(r'\\"', '\x02\x03', Jstr)
106
- Jstr = re.sub(r'"([^"]*)"[\s\t\r\n]*([,\]}])', '\x04\x05\\1\x04\x05\\2', Jstr)
115
+ if type(Jstr) == bytes:
116
+ Jstr = re.sub(r'\\\\'.encode(), '\x00\x01'.encode(), Jstr)
117
+ Jstr = re.sub(r'\\"'.encode(), '\x02\x03'.encode(), Jstr)
118
+ Jstr = re.sub(r'"([^"]*)"[\s\t\r\n]*([,\]}])'.encode(), '\x04\x05\\1\x04\x05\\2'.encode(), Jstr)
107
119
 
108
120
 
109
- Jstr = re.sub(r'"([^"]+)"[\s\t\r\n]*:', r'"\1{dupSign_start}_dupSign_{dupSign_end}":'.format(dupSign_start=dupSign_start_escape, dupSign_end=dupSign_end_escape), Jstr)
121
+ Jstr = re.sub(r'"([^"]+)"[\s\t\r\n]*:'.encode(), r'"\1{dupSign_start}_dupSign_{dupSign_end}":'.format(dupSign_start=dupSign_start_escape, dupSign_end=dupSign_end_escape).encode(), Jstr)
122
+
123
+ Jstr = re.sub(r'""[\s\t\r\n]*:'.encode(), '"{dupSign_start}_dupSign_{dupSign_end}":'.format(dupSign_start=dupSign_start_escape, dupSign_end=dupSign_end_escape).encode(), Jstr)
124
+
125
+ i = 0
126
+ while re.search(r'{dupSign_start}_dupSign_{dupSign_end}"[\s\t\r\n]*:'.format(dupSign_start=dupSign_start_escape, dupSign_end=dupSign_end_escape).encode(), Jstr):
127
+ Jstr = re.sub(r'{dupSign_start}_dupSign_{dupSign_end}"[\s\t\r\n]*:'.format(dupSign_start=dupSign_start_escape, dupSign_end=dupSign_end_escape).encode(), (dupSign_start_escape+"_"+str(i)+"_"+dupSign_end_escape+'":').encode(), Jstr, 1)
128
+ i += 1
129
+
130
+ Jstr = re.sub('\x00\x01'.encode(), r'\\\\'.encode(), Jstr)
131
+ Jstr = re.sub('\x02\x03'.encode(), r'\\"'.encode(), Jstr)
132
+ Jstr = re.sub('\x04\x05'.encode(), r'"'.encode(), Jstr)
133
+ else:
134
+ Jstr = re.sub(r'\\\\', '\x00\x01', Jstr)
135
+ Jstr = re.sub(r'\\"', '\x02\x03', Jstr)
136
+ Jstr = re.sub(r'"([^"]*)"[\s\t\r\n]*([,\]}])', '\x04\x05\\1\x04\x05\\2', Jstr)
137
+
138
+ Jstr = re.sub(r'"([^"]+)"[\s\t\r\n]*:', r'"\1{dupSign_start}_dupSign_{dupSign_end}":'.format(dupSign_start=dupSign_start_escape, dupSign_end=dupSign_end_escape), Jstr)
110
139
 
111
- Jstr = re.sub(r'""[\s\t\r\n]*:', '"{dupSign_start}_dupSign_{dupSign_end}":'.format(dupSign_start=dupSign_start_escape, dupSign_end=dupSign_end_escape), Jstr)
140
+ Jstr = re.sub(r'""[\s\t\r\n]*:', '"{dupSign_start}_dupSign_{dupSign_end}":'.format(dupSign_start=dupSign_start_escape, dupSign_end=dupSign_end_escape), Jstr)
112
141
 
113
- i = 0
114
- while re.search(r'{dupSign_start}_dupSign_{dupSign_end}"[\s\t\r\n]*:'.format(dupSign_start=dupSign_start_escape, dupSign_end=dupSign_end_escape), Jstr):
115
- Jstr = re.sub(r'{dupSign_start}_dupSign_{dupSign_end}"[\s\t\r\n]*:'.format(dupSign_start=dupSign_start_escape, dupSign_end=dupSign_end_escape), dupSign_start_escape+"_"+str(i)+"_"+dupSign_end_escape+'":', Jstr, 1)
116
- i += 1
142
+ i = 0
143
+ while re.search(r'{dupSign_start}_dupSign_{dupSign_end}"[\s\t\r\n]*:'.format(dupSign_start=dupSign_start_escape, dupSign_end=dupSign_end_escape), Jstr):
144
+ Jstr = re.sub(r'{dupSign_start}_dupSign_{dupSign_end}"[\s\t\r\n]*:'.format(dupSign_start=dupSign_start_escape, dupSign_end=dupSign_end_escape), dupSign_start_escape+"_"+str(i)+"_"+dupSign_end_escape+'":', Jstr, 1)
145
+ i += 1
117
146
 
118
- Jstr = re.sub('\x00\x01', r'\\\\', Jstr)
119
- Jstr = re.sub('\x02\x03', r'\\"', Jstr)
120
- Jstr = re.sub('\x04\x05', r'"', Jstr)
147
+ Jstr = re.sub('\x00\x01', r'\\\\', Jstr)
148
+ Jstr = re.sub('\x02\x03', r'\\"', Jstr)
149
+ Jstr = re.sub('\x04\x05', r'"', Jstr)
121
150
 
122
151
  Jloads = json.loads(Jstr)
123
152
  if ordered_dict:
@@ -147,15 +176,13 @@ def loads(Jstr, dupSign_start="{{{", dupSign_end="}}}", ordered_dict=False, _isD
147
176
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
148
177
  # # # # # # # # # # # # # # # load # # # # # # # # # # # # # #
149
178
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
150
- def load(Jfilepath, dupSign_start="{{{", dupSign_end="}}}", ordered_dict=False, _isDebug_=False):
179
+ def load(Jfilepath, dupSign_start="{{{", dupSign_end="}}}", ordered_dict=False, skipDuplicated=False, _isDebug_=False):
151
180
  try:
152
- with open(Jfilepath) as Jfile:
153
- Jstr = Jfile.read()
154
-
155
- return loads(Jstr, dupSign_start=dupSign_start, dupSign_end=dupSign_end, ordered_dict=ordered_dict, _isDebug_=_isDebug_)
181
+ with open(Jfilepath) as Jfile: Jstr = Jfile.read()
156
182
  except Exception as e:
157
- if _isDebug_: print("\x1b[31m[-] ExceptionError: {}\x1b[0m".format(e))
158
- return False
183
+ with open(Jfilepath, "rb") as Jfile: Jstr = Jfile.read()
184
+
185
+ return loads(Jstr, dupSign_start=dupSign_start, dupSign_end=dupSign_end, ordered_dict=ordered_dict, skipDuplicated=skipDuplicated, _isDebug_=_isDebug_)
159
186
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
160
187
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
161
188
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@@ -188,7 +215,7 @@ class JSON_DUPLICATE_KEYS:
188
215
  # User input data type validation
189
216
  if type(_isDebug_) != bool: _isDebug_ = False
190
217
 
191
- if type(name) not in [str, unicode]:
218
+ if type(name) not in [str, unicode]:
192
219
  if _isDebug_: print("\x1b[31m[-] DataTypeError: the KEY name must be str or unicode, not {}\x1b[0m".format(type(name)))
193
220
  return {"name":name, "value":"JSON_DUPLICATE_KEYS_ERROR"}
194
221
 
@@ -211,16 +238,18 @@ class JSON_DUPLICATE_KEYS:
211
238
  Jname = []
212
239
  Jval = self.__Jobj
213
240
  name_split = name.split(separator)
214
- for k in Jobj.getObject().keys():
215
- if len(k.split(separator)) >= len(name_split):
216
- if case_insensitive:
217
- if separator.join(k.split(separator)[:len(name_split)]).lower() == name.lower():
218
- Jname = k.split(separator)[:len(name_split)]
219
- break
220
- else:
221
- if separator.join(k.split(separator)[:len(name_split)]) == name:
222
- Jname = name_split
223
- break
241
+
242
+ if type(Jobj.getObject()) in [dict, OrderedDict]:
243
+ for k in Jobj.getObject().keys():
244
+ if len(k.split(separator)) >= len(name_split):
245
+ if case_insensitive:
246
+ if separator.join(k.split(separator)[:len(name_split)]).lower() == name.lower():
247
+ Jname = k.split(separator)[:len(name_split)]
248
+ break
249
+ else:
250
+ if separator.join(k.split(separator)[:len(name_split)]) == name:
251
+ Jname = name_split
252
+ break
224
253
 
225
254
  if len(Jname) > 0:
226
255
  for k in Jname:
@@ -246,7 +275,7 @@ class JSON_DUPLICATE_KEYS:
246
275
 
247
276
  if type(ordered_dict) != bool: ordered_dict = False
248
277
 
249
- if type(name) not in [str, unicode]:
278
+ if type(name) not in [str, unicode]:
250
279
  if _isDebug_: print("\x1b[31m[-] DataTypeError: the KEY name must be str or unicode, not {}\x1b[0m".format(type(name)))
251
280
  return False
252
281
 
@@ -293,8 +322,12 @@ class JSON_DUPLICATE_KEYS:
293
322
  return True
294
323
  else:
295
324
  if len(name.split(separator)) == 1:
296
- self.getObject()[name] = value
297
- return True
325
+ if type(self.getObject()) in [dict, OrderedDict]:
326
+ self.getObject()[name] = value
327
+ return True
328
+ else:
329
+ if _isDebug_: print("\x1b[31m[-] DataTypeError: Cannot set name and value for a list object\x1b[0m")
330
+ return False
298
331
  else:
299
332
  if self.get(separator.join(name.split(separator)[:-1]), case_insensitive=case_insensitive, separator=separator, parse_index=parse_index)["value"] != "JSON_DUPLICATE_KEYS_ERROR":
300
333
  Jget = self.get(separator.join(name.split(separator)[:-1]), case_insensitive=case_insensitive, separator=separator, parse_index=parse_index)
@@ -327,7 +360,7 @@ class JSON_DUPLICATE_KEYS:
327
360
  # User input data type validation
328
361
  if type(_isDebug_) != bool: _isDebug_ = False
329
362
 
330
- if type(name) not in [str, unicode]:
363
+ if type(name) not in [str, unicode]:
331
364
  if _isDebug_: print("\x1b[31m[-] DataTypeError: the KEY name must be str or unicode, not {}\x1b[0m".format(type(name)))
332
365
  return False
333
366
 
@@ -372,7 +405,7 @@ class JSON_DUPLICATE_KEYS:
372
405
  # User input data type validation
373
406
  if type(_isDebug_) != bool: _isDebug_ = False
374
407
 
375
- if type(name) not in [str, unicode]:
408
+ if type(name) not in [str, unicode]:
376
409
  if _isDebug_: print("\x1b[31m[-] DataTypeError: the KEY name must be str or unicode, not {}\x1b[0m".format(type(name)))
377
410
  return False
378
411
 
@@ -416,7 +449,7 @@ class JSON_DUPLICATE_KEYS:
416
449
  # User input data type validation
417
450
  if type(_isDebug_) != bool: _isDebug_ = False
418
451
 
419
- if type(name) not in [str, unicode]:
452
+ if type(name) not in [str, unicode]:
420
453
  if _isDebug_: print("\x1b[31m[-] DataTypeError: the KEY name must be str or unicode, not {}\x1b[0m".format(type(name)))
421
454
  return False
422
455
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json-duplicate-keys
3
- Version: 2024.12.12
3
+ Version: 2025.7.1
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
@@ -45,8 +45,8 @@ python setup.py install
45
45
  ### normalize_key(`name`, `dupSign_start`="{{{", `dupSign_end`="}}}", `_isDebug_`=False)
46
46
  _Normalize Key name_
47
47
  - `name`: key name
48
- - `dupSign_start`:
49
- - `dupSign_end`:
48
+ - `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
49
+ - `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
50
50
  - `_isDebug_`: Show/ Hide debug error messages
51
51
  ```python
52
52
  import json_duplicate_keys as jdks
@@ -56,12 +56,13 @@ print(jdks.normalize_key("version{{{_2_}}}"))
56
56
  ```
57
57
  ---
58
58
 
59
- ### loads(`Jstr`, `dupSign_start`="{{{", `dupSign_end`="}}}", `ordered_dict`=False, `_isDebug_`=False)
59
+ ### loads(`Jstr`, `dupSign_start`="{{{", `dupSign_end`="}}}", `ordered_dict`=False, `skipDuplicated`=False, `_isDebug_`=False)
60
60
  _Deserialize a JSON format string to a class `JSON_DUPLICATE_KEYS`_
61
61
  - `Jstr`: a JSON format string
62
- - `dupSign_start`:
63
- - `dupSign_end`:
62
+ - `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
63
+ - `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
64
64
  - `ordered_dict`: preserves the order in which the Keys are inserted
65
+ - `skipDuplicated`: Skip loading duplicate keys to improve execution performance
65
66
  - `_isDebug_`: Show/ Hide debug error messages
66
67
  ```python
67
68
  import json_duplicate_keys as jdks
@@ -75,12 +76,13 @@ print(JDKSObject)
75
76
  ```
76
77
  ---
77
78
 
78
- ### load(`Jfilepath`, `dupSign_start`="{{{", `dupSign_end`="}}}", `ordered_dict`=False, `_isDebug_`=False)
79
+ ### load(`Jfilepath`, `dupSign_start`="{{{", `dupSign_end`="}}}", `ordered_dict`=False, `skipDuplicated`=False, `_isDebug_`=False)
79
80
  _Deserialize a JSON format string from a file to a class `JSON_DUPLICATE_KEYS`_
80
81
  - `Jfilepath`: The path to the file containing the JSON format string
81
- - `dupSign_start`:
82
- - `dupSign_end`:
82
+ - `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
83
+ - `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
83
84
  - `ordered_dict`: preserves the order in which the Keys are inserted
85
+ - `skipDuplicated`: Skip loading duplicate keys to improve execution performance
84
86
  - `_isDebug_`: Show/ Hide debug error messages
85
87
  ```python
86
88
  # /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"}]}}
@@ -114,8 +116,8 @@ print(JDKSObject.getObject())
114
116
  _Get value in the JSON object by `name`_
115
117
  - `name`: the key name of the JSON object. Supported flatten key name format
116
118
  - `case_insensitive`: the key name case (in)sensitive
117
- - `separator`:
118
- - `parse_index`:
119
+ - `separator`: Separator for flatten keys (default: `||`)
120
+ - `parse_index`: Symbol for index parsing (default: `$`)
119
121
  - `_isDebug_`: Show/ Hide debug error messages
120
122
  ```python
121
123
  import json_duplicate_keys as jdks
@@ -140,10 +142,10 @@ _Set a new `name` and `value` for the JSON object_
140
142
  - `name`: new key name for the JSON object. Supported flat key name format
141
143
  - `value`: value for key `name`
142
144
  - `case_insensitive`: the key name case (in)sensitive
143
- - `separator`:
144
- - `parse_index`:
145
- - `dupSign_start`:
146
- - `dupSign_end`:
145
+ - `separator`: Separator for flatten keys (default: `||`)
146
+ - `parse_index`: Symbol for index parsing (default: `$`)
147
+ - `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
148
+ - `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
147
149
  - `ordered_dict`: preserves the order in which the Keys are inserted
148
150
  - `_isDebug_`: Show/Hide debug error messages
149
151
  ```python
@@ -178,25 +180,6 @@ print(JDKSObject.getObject())
178
180
  JDKSObject.set("snapshot||author", "truocphan")
179
181
  print(JDKSObject.getObject())
180
182
  # OUTPUT: {'author': 'truocphan', 'version': '22.3.3', 'version{{{_2_}}}': 'latest', 'release': [{'version': 'latest'}], 'snapshot': {'author': 'truocphan'}}
181
-
182
-
183
- Jstr = '[]'
184
- JDKSObject = jdks.loads(Jstr)
185
-
186
- print(JDKSObject.getObject())
187
- # OUTPUT: []
188
-
189
- JDKSObject.set("author", "truocphan")
190
- print(JDKSObject.getObject())
191
- # OUTPUT: [{'author': 'truocphan'}]
192
-
193
- JDKSObject.set("release", [])
194
- print(JDKSObject.getObject())
195
- # OUTPUT: [{'author': 'truocphan'}, {'release': []}]
196
-
197
- JDKSObject.set("$1$||release||", {"version": "latest"})
198
- print(JDKSObject.getObject())
199
- # OUTPUT: [{'author': 'truocphan'}, {'release': [{'version': 'latest'}]}]
200
183
  ```
201
184
  ---
202
185
 
@@ -206,10 +189,10 @@ _Insert `value` at `position` in value list of `name`_
206
189
  - `value`: new value for key `name`
207
190
  - `position`: position of the `value` to insert (default insert at the last position of the list)
208
191
  - `case_insensitive`: the key name case (in)sensitive
209
- - `separator`:
210
- - `parse_index`:
211
- - `dupSign_start`:
212
- - `dupSign_end`:
192
+ - `separator`: Separator for flatten keys (default: `||`)
193
+ - `parse_index`: Symbol for index parsing (default: `$`)
194
+ - `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
195
+ - `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
213
196
  - `_isDebug_`: Show/ Hide debug error messages
214
197
  ```python
215
198
  import json_duplicate_keys as jdks
@@ -235,10 +218,10 @@ _Update new `value` for existing `name` or Set a new `name` in the JSON object_
235
218
  - `value`: new value for key `name`
236
219
  - `case_insensitive`: the key name case (in)sensitive
237
220
  - `allow_new_key`: allows to create a new key name if the key name does not exist
238
- - `separator`:
239
- - `parse_index`:
240
- - `dupSign_start`:
241
- - `dupSign_end`:
221
+ - `separator`: Separator for flatten keys (default: `||`)
222
+ - `parse_index`: Symbol for index parsing (default: `$`)
223
+ - `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
224
+ - `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
242
225
  - `ordered_dict`: preserves the order in which the Keys are inserted
243
226
  - `_isDebug_`: Show/ Hide debug error messages
244
227
  ```python
@@ -263,8 +246,8 @@ print(JDKSObject.getObject())
263
246
  _Delete a key-value pair in a JSON object by key `name`_
264
247
  - `name`: the key name of the JSON object. Supported flatten key name format
265
248
  - `case_insensitive`: the key name case (in)sensitive
266
- - `separator`:
267
- - `parse_index`:
249
+ - `separator`: Separator for flatten keys (default: `||`)
250
+ - `parse_index`: Symbol for index parsing (default: `$`)
268
251
  - `_isDebug_`: Show/ Hide debug error messages
269
252
  ```python
270
253
  import json_duplicate_keys as jdks
@@ -286,10 +269,10 @@ print(JDKSObject.getObject())
286
269
  ---
287
270
 
288
271
  ### JSON_DUPLICATE_KEYS.filter_keys(`name`, `separator`="||", `parse_index`="$", `ordered_dict`=False)
289
-
272
+ _Return a `JSON_DUPLICATE_KEYS` object with keys matching a pattern_
290
273
  - `name`:
291
- - `separator`:
292
- - `parse_index`:
274
+ - `separator`: Separator for flatten keys (default: `||`)
275
+ - `parse_index`: Symbol for index parsing (default: `$`)
293
276
  - `ordered_dict`: preserves the order in which the Keys are inserted
294
277
  ```python
295
278
  import json_duplicate_keys as jdks
@@ -307,10 +290,10 @@ print(JDKSObject.dumps())
307
290
  ---
308
291
 
309
292
  ### JSON_DUPLICATE_KEYS.filter_values(`value`, `separator`="||", `parse_index`="$", `ordered_dict`=False)
310
-
293
+ _Return a `JSON_DUPLICATE_KEYS` object with values matching a pattern_
311
294
  - `value`:
312
- - `separator`:
313
- - `parse_index`:
295
+ - `separator`: Separator for flatten keys (default: `||`)
296
+ - `parse_index`: Symbol for index parsing (default: `$`)
314
297
  - `ordered_dict`: preserves the order in which the Keys are inserted
315
298
  ```python
316
299
  import json_duplicate_keys as jdks
@@ -329,8 +312,8 @@ print(JDKSObject.dumps())
329
312
 
330
313
  ### 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)
331
314
  _Serialize a JSON object to a JSON format string_
332
- - `dupSign_start`:
333
- - `dupSign_end`:
315
+ - `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
316
+ - `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
334
317
  - `_isDebug_`: Show/ Hide debug error messages
335
318
  - For remaining arguments, please refer to [json.dump()](https://docs.python.org/3/library/json.html#json.dump)
336
319
  ```python
@@ -355,8 +338,8 @@ print(JDKSObject.dumps())
355
338
  ### 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)
356
339
  _Serialize a JSON object to a JSON format string and write to a file_
357
340
  - `Jfilepath`: the path to the file to save the JSON format string
358
- - `dupSign_start`:
359
- - `dupSign_end`:
341
+ - `dupSign_start`: Start symbol for marking duplicates (default: `{{{`)
342
+ - `dupSign_end`: End symbol for marking duplicates (default: `}}}`)
360
343
  - `_isDebug_`: Show/ Hide debug error messages
361
344
  - For remaining arguments, please refer to [json.dump()](https://docs.python.org/3/library/json.html#json.dump)
362
345
  ```python
@@ -384,8 +367,8 @@ print(JDKSObject_load.getObject())
384
367
 
385
368
  ### JSON_DUPLICATE_KEYS.flatten(`separator`="||", `parse_index`="$", `ordered_dict`=False, `_isDebug_`=False)
386
369
  _Flatten a JSON object to a single key-value pairs_
387
- - `separator`:
388
- - `parse_index`:
370
+ - `separator`: Separator for flatten keys (default: `||`)
371
+ - `parse_index`: Symbol for index parsing (default: `$`)
389
372
  - `ordered_dict`: preserves the order in which the Keys are inserted
390
373
  - `_isDebug_`: Show/ Hide debug error messages
391
374
  ```python
@@ -407,8 +390,8 @@ print(JDKSObject.getObject())
407
390
 
408
391
  ### JSON_DUPLICATE_KEYS.unflatten(`separator`="||", `parse_index`="$", `ordered_dict`=False, `_isDebug_`=False)
409
392
  _Unflatten a flattened JSON object back to a JSON object_
410
- - `separator`:
411
- - `parse_index`:
393
+ - `separator`: Separator for flatten keys (default: `||`)
394
+ - `parse_index`: Symbol for index parsing (default: `$`)
412
395
  - `ordered_dict`: preserves the order in which the Keys are inserted
413
396
  - `_isDebug_`: Show/ Hide debug error messages
414
397
  ```python
@@ -429,6 +412,14 @@ print(JDKSObject.getObject())
429
412
  ---
430
413
 
431
414
  ## CHANGELOG
415
+ #### [json-duplicate-keys v2025.7.1](https://github.com/truocphan/json-duplicate-keys/tree/2025.7.1)
416
+ - [**Updated**] Fixed some issues when loading JSON strings with `skipDuplicated` option
417
+ - [**Updated**] Allow loading of JSON data in byte string format
418
+ - [**Updated**] Issue with getting and setting an empty list
419
+
420
+ #### [json-duplicate-keys v2025.6.6](https://github.com/truocphan/json-duplicate-keys/tree/2025.6.6)
421
+ - [**Updated**] Added `skipDuplicated` parameter to `load` and `loads` functions to improve performance when parsing large JSON strings by skipping duplicate keys.
422
+
432
423
  #### [json-duplicate-keys v2024.12.12](https://github.com/truocphan/json-duplicate-keys/tree/2024.12.12)
433
424
  - **New**: _insert_ function
434
425
 
@@ -0,0 +1,6 @@
1
+ json_duplicate_keys/__init__.py,sha256=ClhnGD0jyYwBRsOs9zHevi6WWGtnMEOjczwkUC0BMv8,30753
2
+ json_duplicate_keys-2025.7.1.dist-info/LICENSE,sha256=_hudSGMciUc27wGR8EMKfeb3atJRlf6rbhJtLnel-nc,1093
3
+ json_duplicate_keys-2025.7.1.dist-info/METADATA,sha256=wvDz2_ia5VuzhLvNiVZnrI7YJEVfjGVwy07RGb2-dQk,22717
4
+ json_duplicate_keys-2025.7.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
5
+ json_duplicate_keys-2025.7.1.dist-info/top_level.txt,sha256=vdsGrPLVS_l-BFL1i4hCJBY5_-gq4Cwp-11yegA750Y,20
6
+ json_duplicate_keys-2025.7.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.5.0)
2
+ Generator: bdist_wheel (0.45.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,6 +0,0 @@
1
- json_duplicate_keys/__init__.py,sha256=UDxU0fqzAmlqzxZq5Kt_AB07zxkJSGOxir2ZCdXZygc,28844
2
- json_duplicate_keys-2024.12.12.dist-info/LICENSE,sha256=_hudSGMciUc27wGR8EMKfeb3atJRlf6rbhJtLnel-nc,1093
3
- json_duplicate_keys-2024.12.12.dist-info/METADATA,sha256=8pMihvTXCGW5hXVQUa9Avn-0fxFIIS_6dBg02r1UrHg,20715
4
- json_duplicate_keys-2024.12.12.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
5
- json_duplicate_keys-2024.12.12.dist-info/top_level.txt,sha256=vdsGrPLVS_l-BFL1i4hCJBY5_-gq4Cwp-11yegA750Y,20
6
- json_duplicate_keys-2024.12.12.dist-info/RECORD,,