title: Creating a JSON file from JSON response data in Python
body: <p>I want to take the json response data from a REST request and create an actual json file. I tried something like this, but it did not work. Essentially, it just prints the headers. Any suggestions?</p>
  
  <pre><code>params = {'f': 'json', 'where': '1=1', 'geometryType': 'esriGeometryPolygon', 'spatialRel': 'esriSpatialRelIntersects','outFields': '*', 'returnGeometry': 'true'}
  r = requests.get('https://hazards.fema.gov/gis/nfhl/rest/services/CSLF/Prelim_CSLF/MapServer/3/query', params)
  
  cslfJson = r.json()
  path = r"C:/Workspace/Sandbox/ScratchTests/cslf.json"
  file = open(path, 'w')
  for line in cslfJson:
      file.write(line + "\r\n")
  
  file.close()
  </code></pre>