Requiesit Requiesit - 3 months ago 6x
JSON Question

JSON to text file using Python

I have searched for a solution regarding this issue and I have not found one that I can understand. I am new to Python and need basic help understanding why I get the error message: TypeError: is not JSON serializable.

import requests
import json

r = requests.get("")

with open("C:\...MyPath...\Output.txt", "w") as outfile:
json.dumps(r, outfile)

This is my simple code I am testing. I appreciate the help.


You don't need to convert it to/from json. Just keep it as text.

import requests

r = requests.get("")

with open("C:\Users\mhoward2\Documents\Python Scripts\Output.txt", "w") as outfile: