the json serializer is not as robust as the pickle moduleit can only serialize basic types such as integersfloatsand stringsand simple containers such as dictionaries and lists each of these has direct mapping to json representationbut json is unable to represent classesmethodsor functions it is not possible to transmit complete objects in this format because the receiver of an object we have dumped to json format is normally not python objectit would not be able to understand classes or methods in the same way that python doesanyway in spite of the for object in its namejson is data notationobjectsas you recallare composed of both data and behavior if we do have objects for which we want to serialize only the datawe can always serialize the object' __dict__ attribute or we can semiautomate this task by supplying custom code to create or parse json serializable dictionary from certain types of objects in the json moduleboth the object storing and loading functions accept optional arguments to customize the behavior the dump and dumps methods accept poorly named cls (short for classwhich is reserved keywordkeyword argument if passedthis should be subclass of the jsonencoder classwith the default method overridden this method accepts an arbitrary object and converts it to dictionary that json can digest if it doesn' know how to process the objectwe should call the super(methodso that it can take care of serializing basic types in the normal way the load and loads methods also accept such cls argument that can be subclass of the inverse classjsondecoder howeverit is normally sufficient to pass function into these methods using the object_hook keyword argument this function accepts dictionary and returns an objectif it doesn' know what to do with the input dictionaryit can return it unmodified let' look at an example imagine we have the following simple contact class that we want to serializeclass contactdef __init__(selffirstlast)self first first self last last @property def full_name(self)return("{{}format(self firstself last)