I would like to know if there is a way to format the resulting strings to bind any object to json in python. For example, suppose I have the following dictionary:
{'a': 12.73874, 'b': 1.74872, 'c': 8.27495}
and the result of json encoding:
{ "c": 8.27495, "b": 1.74872, "a": 12.73874 }
while I want:
{ "a": 12.74, "c": 8.28, "b": 1.75 }
Pay attention to the order of the elements and decimals of each number. Is there any way to do this?
Thanks in advance!
source share