I am trying to print the JSON with proper indentation and sorted keys, but it throws an error.
Need help to fix this
Complete code :
Need help to fix this
Complete code :
>>> import json >>> import time >>> for n in range(1, 10): ... data = {'id': n, 't': float("%.3f" % time.time()), 'interest':['photo','tt']} ... jsonData=json.dumps(data) ... data = jsonData.encode('utf-8') ... print(data (indent=4, sort_keys=True))...
Error:Traceback (most recent call last):
File "<stdin>", line 5, in <module>
TypeError: 'bytes' object is not callable
>>>