I am currently serializing my custom object into a JSON string by using json.dumps()
.
j = json.dumps(object, sort_keys=True, indent=4, separators=(',', ': '),
default=lambda o: o.__dict__)
My object has an attribute called _machines
. So when we turn the object into a string one of the properties in the string is called _machines
. Is there any way to tell json.dump()
that we want this property to be called machines
rather then _machines
?