GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Pass `json.dumps` parameters in `DeepDiff.to_json` #226 · adjust/deepdiff@9b4fd51

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
Filter options
  • .github
    • FUNDING.yml
  • CHANGELOG.md
  • deepdiff
    • serialization.py
  • docs
    • changelog.rst
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/FUNDING.yml‎

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: [seperman]
2+
ko_fi: seperman
Collapse file

‎CHANGELOG.md‎

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 numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# DeepDiff Change log
22

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.
44
- v5-2-2: Fixed Delta serialization when None type is present.
55
- 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.
66
- v5-0-2: Bug Fix NoneType in ignore type groups https://github.com/seperman/deepdiff/issues/207
Collapse file

‎deepdiff/serialization.py‎

Copy file name to clipboardExpand all lines: deepdiff/serialization.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def from_json_pickle(cls, value):
116116
else:
117117
logger.error('jsonpickle library needs to be installed in order to run from_json_pickle') # pragma: no cover. Json pickle is getting deprecated.
118118

119-
def to_json(self, default_mapping=None):
119+
def to_json(self, default_mapping=None, **kwargs):
120120
"""
121121
Dump json of the text view.
122122
**Parameters**
@@ -127,6 +127,8 @@ def to_json(self, default_mapping=None):
127127
If you have a certain object type that the json serializer can not serialize it, please pass the appropriate type
128128
conversion through this dictionary.
129129
130+
kwargs: Any other kwargs you pass will be passed on to Python's json.dumps()
131+
130132
**Example**
131133
132134
Serialize custom objects
@@ -147,7 +149,7 @@ def to_json(self, default_mapping=None):
147149
'{"type_changes": {"root": {"old_type": "A", "new_type": "B", "old_value": "obj A", "new_value": "obj B"}}}'
148150
"""
149151
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)
151153

152154
def to_dict(self, view_override=None):
153155
"""
Collapse file

‎docs/changelog.rst‎

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 numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Changelog
55

66
DeepDiff Changelog
77

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.
99
- v5-2-2: Fixed Delta serialization when None type is present.
1010
- 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.
1111
- v5-0-2: Bug Fix NoneType in ignore type groups https://github.com/seperman/deepdiff/issues/207

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.