Saravanan666/pypi-org huggingface dataset:
Package: jsoncsv
jsoncsv : easily convert json to csv or xls[x]jsoncsv (withmkexcel) is a command tool to convert json file to csv/xlsx file.It’s simple, and no need user to specify the keys.Just use them.Quick Start :cat the raw.json to csv/xls use command line toolcatraw.json|jsoncsv|mkexcel>output.csvcatraw.json|jsoncsv|mkexcel-txls>output.xlsmake sure each line of raw json text file is a json object$catraw.json{"id":1,"name":"A","year":2015}{"id":2,"name":"S","zone":"china"}$catraw.json|jsoncsv|mkexcel>output.csv$catoutput.csvid,name,year,zone1,A,2015,2,S,,chinaThis is easily and needn’t care the different keys from any two object.if input file is an json_array, use-A/–arrayto decode it$catraw.json[{"id":1,"name":"A","year":2015},{"id":2,"name":"S","zone":"china"}]$catraw.json|jsoncsv-A|mkexcel>output.csv$catoutput.csvid,name,year,zone1,A,2015,2,S,,chinaanother way to convert file step by step$jsoncsvraw.jsonexpand.json$mkexcelexpand.json-txlsoutput.xlsget more options with–help.jsoncsv--helpmkexcel--helpInstallpipinstalljsoncsvUsagesee #QuickStart and get more options with–help.just expand/restore the json, the expand json is one layer json.jsoncsvraw.jsonexpand.jsonjsoncsv-rexpand.jsonraw.jsoncatraw.json|jsoncsv|jsoncsv-r>raw2.jsonmkexcel the expanded json (one layer)mkexcelexpand.jsonoutput.csvmkexcel-txlsexpand.json>output.xlsmkexcel-tcsvexpand.json>output.csv-e, –expandexpand json, 展开 json$jsoncsv-eraw.jsonexpand.json$catraw.jsonexpand.json{"s":[1,2,{"w":1}]}{"s.2.w":1,"s.0":1,"s.1":2}{“s”:[1,2,{“w”:1}]} will transformed to {“s.2.w”: 1,”s.0”: 1,”s.1”: 2}the output “expand.json” is only one layer json, it can be easy change to csv or xlsx (withmkexcel)-r, –restorerestore the expanded json 重构被展开的jsonjsoncsv-rexpand.jsonraw.jsoncatexpand.jsonraw.json{"s.2.w":1,"s.0":1,"s.1":2}{"s":[1,2,{"w":1}]}{“s.2.w”: 1,”s.0”: 1,”s.1”: 2} change to {“s”:[1,2,{“w”:1}]}-s, –separatorseparator used for combine the keys in the treedefault separator is.–safeon safe mode, use escape separator to avoid confilctexpand:[‘aa’, ‘bb’, ‘www.xxx.com’] –> ‘aa.bb.www.xxx.com’restore:‘aa.bb.www.xxx.com’ –> [‘aa’, ‘bb’, ‘www.xxx.com’]mkexceldump expanded (byjsoncsv) json file to csv or xls filemkexcelexpand.jsonoutput.csv-t, –typechose dump type in [‘csv’, ‘xls’] default is ‘csv’catexpand.json|mkexcel-tcsv>output.csvcatexpand.json|mkexcel-txls>output.xlsNOTE/TODO1. dict keys can’t be  just array indexesexample:echo'{"0":1,"1":[1,2]}'|jsoncsv-e|jsoncsv-r[1,[1,2]]2. mkexcel enable hookswait next next version3. unicodecsv is not good enoughbut better than python strand library csv.4. Windows is poor supportseehttps://github.com/alingse/jsoncsv/issues/37try usehttps://jsoncsv.jsonutil.online/instead
Package: json-csv-combiner
json-csv-combinerMerges multiple JSON/EXCEL/CSV file into a single file.⚙️ InstallationYou can install it fromPyPI💻 How to UseYou can run it as a module in the commandline with a single line. It can combine multiple json/csv/excel file in a folder to single output file.$ python jce -t [Type of file] -o [output file name]Example$ python jce -t json -o combined.jsonOptions-t    [json][csv][excel]

-o    filename.[json][csv][xlsx]📑 Release History0.1.2Initial release🚧🚀 ContributingFeel free to contribute with anything.⚖️ LicenseCopyright (c) 2021 Shikrishna Joisa.Distributed under the MIT license.SeeLICENSEfor more information.
Package: jsoncsvtxt
This is a simple example package. You can use to
create/read/write/truncate...a json or csv or txt file
using python.for json filecreat :: jsoncreat (name)
write :: jsonwrite (name ,added_value)
append :: Jsonappand (name, added_value)
read :: jsonread (name)
delet ::  Jsondelet (name)for csv filecreat :: Csvcreat (name)
write :: Csvwrite (name ,added_value)
append :: Csvappand (name,added_value)
read :: Csvread (name)
delet :: Csvdelet (name)for txt filecreat :: Txtcreat (name)
write :: Txtwrite (name ,added_value)
append :: Txtappand (name,added_value)
read :: Txtread (name)
delet :: Txtdelet (name)if you get a problemes or you have a quoitions visite
our web site"https://docs.python.org/3/"
Package: jsond
jsondAn extension of json: but one that (naively) handles dates.InstallationYou can use pip. (Note that it usessetuptools)pip install jsondTo also install development tools use:pip install jsond[dev]
# or
pip install -e .[dev]Simple UsageI have a date.>>>importdatetime>>>my_date=datetime.datetime(2011,3,15,0,0,0)Standardjsondoesn't deal with dates :(>>>importjson>>>json.dumps(my_date)Traceback(mostrecentcalllast):File"<stdin>",line1,in<module>File"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",line243,indumpsreturn_default_encoder.encode(obj)File"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py",line207,inencodechunks=self.iterencode(o,_one_shot=True)File"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py",line270,initerencodereturn_iterencode(o,0)File"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py",line184,indefaultraiseTypeError(repr(o)+" is not JSON serializable")TypeError:datetime.datetime(2011,3,15,0,0)isnotJSONserializableButjsondwill handle it>>>importjsond>>>jsond.dumps(my_date)'"datetime:2011-03-15T00:00:00"'>>>And we can pull the date back as well.>>>jsond.loads('"datetime:2011-03-15T00:00:00"')datetime.datetime(2011,3,15,0,0)>>>date2=jsond.loads('"datetime:2011-03-15T00:00:00"')>>>type(date2)<type'datetime.datetime'>>>>date2==my_dateTrue>>>date2datetime.datetime(2011,3,15,0,0)>>>Also,jsondwill produce output that won't breakjson.
(Though of course, you'll get a string rather than a datetime object.)>>>enc=jsond.dumps(my_date)>>>json.loads(enc)u'datetime:2011-03-15T00:00:00'>>>Other usageOften message-processing systems will use json internally to serialise messages.But that means that dates can't (easily) be used.To help with this, we provide two functions:from_json_serialisable_objectandto_json_serialisable_object.For those who prefer spelling serialise with a 'z', there are two 'alias'
functions for convenience.from_json_serializable_object->from_json_serialisable_objectto_json_serializable_object->to_json_serialisable_objectdefhandle_message(original_message):# At this stage original_message will be a dict, list etc, but it won't# have any datetime objects as it was json-serialisable.# We might have prepared it earlier with jsond.dumps, but that means that# we have 'datetime:...' string instead of datetime objects.message=jsond.from_json_serialisable_object(original_message)# message will now have datetime objects# We can do whatever processing we want.# Now we have to put message back on the queue. We have to output an# object that the broker will put back onto the queue etc.# So we can't have datetime objects. But we want to output an object# (not an encoded string).new_message=jsond.to_json_serialisable_object(message)# Now we can output/emit/etc new_message.returnnew_message
Package: jsondatabase
A flat file database for json objects.Home-page: https://github.com/gunthercox/jsondbAuthor: Gunther CoxAuthor-email: gunthercx@gmail.comLicense: BSDDescription: # jsondb[![Build Status][travis-image]][travis-build][![PyPI version](https://badge.fury.io/py/jsondatabase.svg)](https://badge.fury.io/py/jsondatabase)This is a utility for managing content in a database which storescontent in JSON format.## InstallationThis package can be installed from [PyPi](https://pypi.python.org/pypi/jsondatabase) by running:```bashpip install jsondatabase```Note, the package name and the import name are different.Import the package using `import jsondb`.## Usage```pythonfrom jsondb.db import Databasedb = Database("mydata.db")```The database has an attribute which works similar to[jQuery's `data`][jquery-data] attribute.```python# Getting all datadb = Database("mydata.db")print(db.data())``````python# Getting a stored valuedb = Database("mydata.db")print(db.data(key="user_count"))```**It is important to note that a key will be created regardless of whether itexists as long as a value is provided.** The database has the same functionalityas a dictionary.```python# Setting a valuedb = Database("mydata.db")db.data(key="user_count", value=241)``````python# Passing in a dictionary valuedb = Database("mydata.db")data = {"user_id": 234565,"user_name": "AwesomeUserName","is_moderator": True,}db.data(dictionary=data)``````python# Deleting a valuedb = Database("mydata.db")db.delete("my_key")```The database also supports a dictionary-like syntax for retrieving, setting, andremoving values.```pythondb = Database("mydata.db")# Retrieving a valuevalue = db["key"]# Setting a valuedb["key"] = value# Removing a keydel db["key"]# Checking if a key exists"key" in db```## PerformanceIf performance is an issue with large databases then the `python-cjson` modulecan be installed. jsondb will automatically detect this and use cjson instead.[jquery-data]: http://api.jquery.com/data/[travis-build]: https://travis-ci.org/gunthercox/jsondb[travis-image]: https://travis-ci.org/gunthercox/jsondb.svgHistory-------`See release notes<https://github.com/gunthercox/jsondb/releases>`_Keywords: jsondbPlatform: UNKNOWNClassifier: Development Status :: 2 - Pre-AlphaClassifier: Intended Audience :: DevelopersClassifier: License :: OSI Approved :: BSD LicenseClassifier: Natural Language :: EnglishClassifier: Programming Language :: Python :: 2Classifier: Programming Language :: Python :: 2.6Classifier: Programming Language :: Python :: 2.7Classifier: Programming Language :: Python :: 3Classifier: Programming Language :: Python :: 3.3Classifier: Programming Language :: Python :: 3.4
Package: jsondataclasses
JSON DataclassesTyped JSON dataclasses for Python 3.9+Check out the docsInstallationpip install jsondataclassesUsagefromdatetimeimportdatefromtypingimportLiteral,Optionalfromjsondataclassesimportjsondataclass,jsonfielddefparse_date(date_string:str)->date:returndate.fromisoformat(date_string.replace(".","-"))@jsondataclassclassCar:make:Literal["Ford","Renault","Volkswagen"]=jsonfield("carMake")model:str=jsonfield("model")manufactured_at:date=jsonfield("dateOfManufacture",parse_date)num_of_wheels:Optional[int]=jsonfield("numberOfWheels",default_value=4)car=Car({"carMake":"Ford","model":"Focus","dateOfManufacture":"2018.03.14"})print(car)# Car(make='Ford', model='Focus', manufactured_at=datetime.date(2018, 3, 14), num_of_wheels=4)Class field types can be any primitive type (eg.str,int,datetime),
a variadic generic (eg.list[str],Optional[int],Literal["hello", "world"]),
or even another jsondataclass. Thedefault_valueargument ofjsonfieldwill be used
if the specified key is not found in the dictionaryandthe type of the class field is notOptional[...].
In this case, the value ofdefault_valuewill be passed to the supplied parser function.
Package: json-dataclass-io-hooks
JSON encoder/decoder hooks for Python dataclassesThis project contains custom hooks that can be used with Python's json package.
These hooks can be to produce JSON from and to predefined existing dataclasses.Source:https://stackoverflow.com/questions/53376099/python-dataclass-from-dict#answer-53505530Usagejson_str=json.dumps(dataclass_object,default=dataclass_object_dump)dataclass_object=json.loads(json_str,object_hook=dataclass_object_load)
Package: jsondatasave
jsondatasaveDocumentationIntroductionjsondatasaveis a simple Python library that facilitates the process of storing and retrieving JSON data. It provides an intuitive interface to read and write JSON data to and from files.InstallationTo installjsondatasave, you can usepip:pip install jsondatasaveFeaturesSimple JSON data reading and writing.Minimalistic API with just two main functions:loadandsave.Functionsload(FileName)This function reads a JSON file and returns its content as a Python dictionary.Parameters:FileName(str): The path to the JSON file that you wish to read.Returns:dict: The content of the JSON file as a Python dictionary.Example:data=load("sample.json")print(data)save(Data, Filename)This function writes a Python dictionary to a JSON file.Parameters:Data(dict): The Python dictionary that you wish to save to a file.Filename(str): The path to the file where the data should be saved.Returns:dict: The same Python dictionary that was provided as input.Example:data={"name":"John","age":30}save(data,"output.json")DependenciesCurrently, there are no external dependencies for this library. The comment insetup.pyregarding 'hashl' is not related to the provided functions.Licensejsondatasaveis licensed under the MIT license.AuthorCreated by YourAverageDev.
Package: jsondate
Sick of rewriting the same JSON datetime handling code for each project?jsondateis a drop-in replacement for Python’s standardjsonlibrary that
adds sensible handling ofdatetimeanddateobjects.jsondateuses ISO8601 for encodingdatetimeobjects and the
date-specific part of ISO6801 for encodingdateobjects.Example:import datetime
import jsondate as json

>>> data = json.dumps(dict(created_at=datetime.datetime(2012, 10, 31)))
'{"created_at": "2012-10-31T00:00:00Z"}'

>>> json.loads(data)
{u'created_at': datetime.datetime(2012, 10, 31, 0, 0)}

>>> date = json.dumps(dict(date=datetime.date(2012, 10, 31)))
'{"date": "2012-10-31"}'

>>> json.loads(data)
{u'created_at': datetime.date(2012, 10, 31)}Unicode Empty StringsThejsonstandard library module will returnunicodeobjects for all
strings except empty strings, which are returned asstrobjects.This inconsistency can be annoying when using libraries that expect all input
to beunicode.jsondatefixes this by returning empty-strings asunicodeobjects as
well.
Package: jsondate3-aware
Sick of rewriting the same JSON datetime handling code for each project?jsondate3-awareis a drop-in replacement for Python’s standardjsonlibrary that
adds sensible handling ofdatetimeanddateobjects.jsondate3-awareuses ISO8601 for encodingdatetimeobjects and the
date-specific part of ISO6801 for encodingdateobjects.It:supports Python 2 and 3creates timezone-aware datetime objects when ablesupports JavaScript-style dates (datetime.datetime(%Y, %m, %d, %H, %M, %S))Example:import datetime
import jsondate3 as json

>>> data = json.dumps(dict(created_at=datetime.datetime(2012, 10, 31)))
'{"created_at": "2012-10-31T00:00:00Z"}'

>>> json.loads(data)
{u'created_at': datetime.datetime(2012, 10, 31, 0, 0, tzinfo=datetime.timezone.utc)}

>>> date = json.dumps(dict(date=datetime.date(2012, 10, 31)))
'{"date": "2012-10-31"}'

>>> json.loads(data)
{u'created_at': datetime.date(2012, 10, 31)}TestingRun them with:python -m unittest tests.test_jsondateDeploymentIf you wish to create a new version manually, the process is:Update version info insetup.pyInstall the requirements in requirements_dev.txtSet up a config file at ~/.pypircGenerate a universal distribution that worksin py2 and py3 (see setup.cfg)rm -r dist &&  python setup.py sdist bdist_wheelUpload the distributionstwine upload dist/* -r pypi (or pypitest)
Package: jsondatetime
jsondatetimejsondatetimeallows for proper decoding of datetime values contained in
JSON streams.The problemThe JSON standard RFC 4627 does not support datetime types. These are
usually represented as strings and Python decoders end up decoding them
as such. Consider the following example:importsimplejsonasjson>>>test='{"name": "John Doe", "born": "Thu, 1 Mar 2012 10:00:49 UTC"}'>>>json.loads(test){'born':u'Thu, 1 Mar 2012 10:00:49 UTC','name':u'John Doe'}As you can see, in the resulting dictionarybornis still a string.The solutionjsondatetimeis a very simple wrapper around Python simplejsonloadsanddumpsmethods. It decodes datetime values contained in JSON
strings:importjsondatetimeasjson>>>test='{"name": "John Doe", "born": "Thu, 1 Mar 2012 10:00:49 UTC"}'>>>j=json.loads(test);j{'name':'John Doe','born':datetime.datetime(2012,3,1,10,0,49,tzinfo=tzutc())}>>>dumps(j)"{'name': 'John Doe', 'born': '2012-03-01T10:00:49+00:00'}"Strings are parsed usingdateutil.parser.parsewhich is fairly
flexible for common datetime formats.Custom parsingBeing just a wrapper around theloadsmethod, you can still use all
the standardloadsarguments,object_hookincluded. This means that
you can still perform custom parsing of your inbound JSON stream.Installationpip install jsondatetime
Package: jsondb
========jsondb========Off-memory json for large data that does not fit the memory.![Build Status](https://secure.travis-ci.org/shaung/jsondb.png?branch=develop)Installation----------------------To install, simply run ::python setup.py installGetting started----------------------To create a db: ::import jsondb# Create from an empty dict (the default)db = jsondb.create({})# Or a list / tupledb = jsondb.create([])to create from an existing JSON file: ::db = jsondb.from_file(json_file_path)# file-like objects are accepted as welldb = jsondb.from_file(open(json_file_path, 'rb'))Now add some data to the db and access them:db['name'] = 'foo'assert db['name'] == 'foo'db['items'] = []for i in range(3):db['items'].append({'id' : i,'name': chr(97 + i),})assert db['items'][0]['id'] == 0assert len(db['items']) == 3assert db.get('nonexists', 'notfound') == 'notfound'It works like an ordinary dict / list,but to get its value, use the `data()` method:# => 'foo'print db['name'].data()# Get the dataassert db.data() == {'name' : 'foo','items': [{'id' : 0, 'name' : 'a'},{'id' : 1, 'name' : 'b'},{'id' : 2, 'name' : 'c'},]}Querying----------------------jsondb also supports complex queries, in a syntax based on JSONPath,which is described here: http://goessner.net/articles/JsonPath/`db.query` returns a `QueryResult` object which is iterable.results = db.query('$.items.name')# Iterating the query result#   => "a b c"for x in results:print x.data(),To fetch all the value of the result,# => ['a', 'b', 'c']print rslt.values()To fetch only one value,# fetch one resultassert db.query('$.name').getone() == 'foo'# => 'foo'db.query('$.name').getone().data()Example of more complex queries:# Conditonal query#   => 'b'print db.query('$.items[?(@.id = 1)].name').getone().data()# slicing# => ['a', 'b']print db.query('$.items[:-1].name').values()Persistence----------------------All the data is stored on the disk.In the current implementation, data is saved as a sqlite database,but supports for other DBMS are on the table.both of `create` and `from_file` accept a `url` parameter,indicating where to store the data:db = jsondb.create({}, url='path/to/filename.db')# which is equal todb = jsondb.create({}, url='sqlite3://path/to/filename.db')When not specified, a temporary file will be created in `/tmp` by default.To make sure all the changes made to db being saved to the file,db.save()And when not needed anymore, remember to close it:db.close()Or use context manager:with jsondb.create(url='path/to/filename.db') as db:# do all the work hereTo load an existing jsondb file later,db = jsondb.load('path/to/filename.db')License----------------------Released under the BSD license.
Package: jsondbase
JsonDBaseUse the json file as a local database and do not need to install anything elsefeature add, delete, exist, find in any level nested json treeInstallpip3 install jsondbaseUsageisRecordExistfrom jsondbase import LocalDatabase

db = LocalDatabase(dbname="session.json")

"""
example of session.json
[{
    "company": "ABC"  
    "employee": {  
        "name":       "sonoo",   
        "salary":      56000,   
        "married":     true  
    }  
}]  
"""
#                 value  key
db.isRecordExist("ABC", "comapny")
# find in other level
db.isRecordExist("sonoo", "employee:name")addRecordfrom jsondbase import LocalDatabase

db = LocalDatabase(dbname="session.json")

json = {
    "company": "ABC"  
    "employee": {  
        "name":       "sonoo",   
        "salary":      56000,   
        "married":     true  
    }  
}  

db.addRecord(json)deleteRecordfrom jsondbase import LocalDatabase

db = LocalDatabase(dbname="session.json")

"""
example of session.json
[{
    "company": "ABC"  
    "employee": {  
        "name":       "sonoo",   
        "salary":      56000,   
        "married":     true  
    }  
}]  
"""
#                 value  key
db.deleteRecord("ABC", "comapny")
# delete in other level
db.deleteRecord("sonoo", "employee:name")getRecordfrom jsondbase import LocalDatabase

db = LocalDatabase(dbname="session.json")

"""
example of session.json
[{
    "company": "ABC"  
    "employee": {  
        "name":       "sonoo",   
        "salary":      56000,   
        "married":     true  
    }  
}]  
"""
#                 value  key
db.getRecord("ABC", "comapny")
# get record in other level
db.getRecord("sonoo", "employee:name")
Package: jsondbpy
JSON DBSimple python local databaseQuick start:fromjsondbimportManagermanager=Manager("database.test")data=manager.get()if"nick"notindata:data["nick"]=input("Enter your nickname: ")manager.save()nick=data["nick"]print("Hello,%s"%nick)>>> Enter your nickname: ZoomDeveloper
Hello, ZoomDeveloperHello, ZoomDeveloper
Package: json-de2zh
json-de2zhjson-de2zh gen_cmat based on fundset (stardict)Install itpipinstallgit+https://github.com/ffreemt/json-de2zh# poetry add git+https://github.com/ffreemt/json-de2zh# git clone https://github.com/ffreemt/json-de2zh && cd json-de2zhUse itfromjson_de2zhimportjson_de2zh
Package: json-default
OverviewWhilst looking about to see if anyone had proposed a __json__ protocol for
Python, I foundthis articleand
it struck me as so simple and obviously right.So, I decided to provide a lib to make it easier for everyone.UsageJust pass json_default.default as the default function when calling json.dump(s).importjsonfromjson_defaultimportdefault...returnjson.dumps(mydata,default=default)If you have more types you want to define serialisation for, just add them:fromjson_defaultimportdefault@default.register(mytype):def_(obj):...
Package: json-delta
json-delta: A diff/patch pair and library for JSON data
structures. (http://json_delta.readthedocs.org/)JSON-delta is a multi-language software suite for computing deltas
between JSON-serialized data structures, and applying those deltas as
patches.  It enables separate programs at either end of a
communications channel (e.g. client and server over HTTP, or two
processes talking to one another using bidirectional IPC) to
manipulate a data structure while minimizing communications overhead.This is the python implementation.  It requires Python version 2.7 or
newer (including Python 3).  It can be installed in the standard way:$ python setup.py install(potentially needing superuser privileges).  This will install a
single module named json_delta, and scripts named json_diff,
json_patch and json_cat.HTML documentation for all four of these can be found in the doc/
directory, along with manpages for the scripts.Donations to support the continuing development of JSON-delta will be
gratefully received via gratipay (https://gratipay.com/phijaro),
PayPal (himself@phil-roberts.name) or
Bitcoin: (1HPJHRpVSm1Y4zrgppd2c6LysjxeabbQN4).
Package: jsonderef
jsonderefA json dereferencing library for python.Json pointers evaluation is compliant with rfc 6901
(https://tools.ietf.org/html/rfc6901).InstallationBest way is to usepip.pipinstalljsonderefUsagefromjsonderefimportJsonDerefdocument={"key":"value","ref":{"$ref":"#/key"},"array_ref":[{"$ref":"#/key"}],"nested_ref":{"nest":{"$ref":"#/nested_ref"}}}dereferencer=JsonDeref(document)printdereferencer.deref(max_deref_depth=5)TestsClone the repo, install dependencies and run nose.virtualenvenv.env/bin/activatepipinstall-rrequirements.txtnoseteststests.py
Package: json-deserializer
json-deserializerAttempts to deserialize objects into a format that json.dumps/json.loads can use.Anything that is a Sequence, but not a str will be cast to a list.All Mappings will be cast to dictsDecimal to floatsCallable to string (will return Object.repr)NamedTuple to dictUsage Example>>>fromjsonimportdumps>>>fromcollectionsimportUserDict>>>fromjson_deserializerimportdeserialize>>>>>>classMyDict(UserDict):>>>pass>>>>>>d=MyDict({"foo":"bar"})>>>try:>>>dumps(d)>>>exceptExceptionase:>>>print(e)ObjectoftypeMyDictisnotJSONserializable>>>dumps(d,default=deserialize)'{"foo": "bar"}'Youcanalsoimportdump,load,dumps,andloadsdirectlyfromjson_deserializerwhichwillcalljson.loads,json.dumpswithdefault=json_deserializer.deserialize.