In order to better debug my api, I would like to create a debug page which shows all details of the response json obj line by line. I think it can be done by code or django template. What is the simplest way to do it?
https://developers.facebook.com/tools/explorer/?method=GET For example, facebook explorer does list details of the response json obj like this.
{
"id": "xxx",
"name": "xxx",
"first_name": "xxx",
"last_name": "xxx",
"link": "xxx",
"username": "xxx",
"hometown": {
"id": "xxx",
"name": "xxx"
},
"location": {
"id": "xxx",
"name": "xxx"
},
"bio": "Drink Coffee in Whitehorse",
"work": [
{
"employer": {
"id": "xxx",
"name": "xxx"
},
"location": {
"id": "xxx",
"name": "xxx"
},
"position": {
"id": "xxx",
"name": "xxx"
},
"start_date": "2009-01",
"end_date": "0000-00"
},
}
You just need to call json.dumps() with the indent keyword argument equal to the number of spaces to indent the generated JSON by for pretty printing.
For example:
json.dumps(spam_and_eggs, indent=4)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With