This repository was archived by the owner on Dec 11, 2023. It is now read-only.
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboard +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +github: [seperman] |
| 2 | +ko_fi: seperman |
Collapse file
Copy file name to clipboardExpand all lines: CHANGELOG.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | # DeepDiff Change log |
2 | 2 |
|
3 | | -- v5-2-3: Retaining the order of multiple dictionary items added via Delta. Fixed the typo with yml files in deep cli. Fixing Grep RecursionError where using non UTF-8 character. |
| 3 | +- v5-2-3: Retaining the order of multiple dictionary items added via Delta. Fixed the typo with yml files in deep cli. Fixing Grep RecursionError where using non UTF-8 character. Allowing kwargs to be passed to to_json method. |
4 | 4 | - v5-2-2: Fixed Delta serialization when None type is present. |
5 | 5 | - v5-2-0: Removed Murmur3 as the preferred hashing method. Using SHA256 by default now. Added commandline for deepdiff. Added group_by. Added math_epsilon. Improved ignoring of NoneType. |
6 | 6 | - v5-0-2: Bug Fix NoneType in ignore type groups https://github.com/seperman/deepdiff/issues/207 |
|
Collapse file
Copy file name to clipboardExpand all lines: deepdiff/serialization.py +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -116,7 +116,7 @@ def from_json_pickle(cls, value): |
116 | 116 | else: |
117 | 117 | logger.error('jsonpickle library needs to be installed in order to run from_json_pickle') # pragma: no cover. Json pickle is getting deprecated. |
118 | 118 |
|
119 | | - def to_json(self, default_mapping=None): |
| 119 | + def to_json(self, default_mapping=None, **kwargs): |
120 | 120 | """ |
121 | 121 | Dump json of the text view. |
122 | 122 | **Parameters** |
@@ -127,6 +127,8 @@ def to_json(self, default_mapping=None): |
127 | 127 | If you have a certain object type that the json serializer can not serialize it, please pass the appropriate type |
128 | 128 | conversion through this dictionary. |
129 | 129 |
|
| 130 | + kwargs: Any other kwargs you pass will be passed on to Python's json.dumps() |
| 131 | +
|
130 | 132 | **Example** |
131 | 133 |
|
132 | 134 | Serialize custom objects |
@@ -147,7 +149,7 @@ def to_json(self, default_mapping=None): |
147 | 149 | '{"type_changes": {"root": {"old_type": "A", "new_type": "B", "old_value": "obj A", "new_value": "obj B"}}}' |
148 | 150 | """ |
149 | 151 | dic = self.to_dict(view_override=TEXT_VIEW) |
150 | | - return json.dumps(dic, default=json_convertor_default(default_mapping=default_mapping)) |
| 152 | + return json.dumps(dic, default=json_convertor_default(default_mapping=default_mapping), **kwargs) |
151 | 153 |
|
152 | 154 | def to_dict(self, view_override=None): |
153 | 155 | """ |
|
Collapse file
Copy file name to clipboardExpand all lines: docs/changelog.rst +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,7 @@ Changelog |
5 | 5 |
|
6 | 6 | DeepDiff Changelog |
7 | 7 |
|
8 | | -- v5-2-3: Retaining the order of multiple dictionary items added via Delta. Fixed the typo with yml files in deep cli. Fixing Grep RecursionError where using non UTF-8 character. |
| 8 | +- v5-2-3: Retaining the order of multiple dictionary items added via Delta. Fixed the typo with yml files in deep cli. Fixing Grep RecursionError where using non UTF-8 character. Allowing kwargs to be passed to to_json method. |
9 | 9 | - v5-2-2: Fixed Delta serialization when None type is present. |
10 | 10 | - v5-2-0: Removed Murmur3 as the preferred hashing method. Using SHA256 by default now. Added commandline for deepdiff. Added group_by. Added math_epsilon. Improved ignoring of NoneType. |
11 | 11 | - v5-0-2: Bug Fix NoneType in ignore type groups https://github.com/seperman/deepdiff/issues/207 |
|