Closed drallieiv closed 8 years ago
The output was never JSON but a dict. As the dict now contains some binary data, it is uncompatible with JSON as this is not a native type of it. Please use pprint like in my pokecli.py :)
The thing is that I was parsing the output in Javascript (with a JSON.parse()) to display it nicely in html.
I tried using the pprint format, but I haven't found any library than can reads it, and do not plan on making my own.
A recursive function which will decode all bytes of the dict could be a solution. Then JSON.dump can be used again.
@drallieiv Did you found a solution?
@tejado I'm still using an older version of the project with the previous protofiles.
I added an JSONByteEncoder https://github.com/tejado/pgoapi/commit/ebffcdb60815a338d8a4171f8a33577e8dccb66f which should resolve your issue.
Example: https://github.com/tejado/pgoapi/blob/master/pokecli.py#L163
I tried a previous version earlier today (on another desktop) and the output was in nice JSON with format(json.dumps(response_dict, indent=2)))
I tried changing changing back from pprint.PrettyPrinter to json.dumps but It no longer works. but now I get errors : TypeError: b'/yVMMtOIff1pLzN/MxHIDBcVjLdCIm6n01fIwhSiEqoinLB+jc6fY5c2MSud5ysV7hBfrZqUbgATBOgE3K8zBA==' is not JSON serializable
Any idea why ?