title: JSON List of Dictionaries Querying in AWS Athena/Glue vs Quicksight
body: <p>(This question is very similar to <a href="https://stackoverflow.com/questions/42034094/store-multiple-elements-in-json-files-in-aws-athena">Store multiple elements in json files in AWS Athena</a>)</p>
  
  <p>I have a JSON file in an S3 bucket that is structured like this - </p>
  
  <pre><code>[{"key1": value, "key2": value, "key3": {"key4": value, etc}}, {"key1": value....}]
  </code></pre>
  
  <p>Two questions: </p>
  
  <ol>
  <li><p>Why is it that if I send this directly to Quicksight, Quicksight knows to normalize the file perfectly (unless there are multiple files in the bucket that don't match (which is why I'm trying Athena)) but Athena struggles with it? I know it has something to do with formatting (each dictionary isn't on its own line, it's a list of dictionaries and not just dictionaries, etc) but it seems so unnecessary to modify the original file if there is another service on AWS that knows how to parse and flatten it without an issue. </p></li>
  <li><p>I'm using a Python script in Lambda to call the API and the list of dictionaries is the format it comes in. Is there a simple way to format the JSON file in the way Athena likes? Below is an example of my current script - </p></li>
  </ol>
  
  <pre><code>response = requests.request(method, url, **kwargs)
  data_dict = response.json()
  data_json = json.dumps(data_dict['results'])
  s3.Bucket('bucket_name').put_object(Key = key, Body = data_json)
  </code></pre>
  
  <p>Disclaimer: I am fairly new to AWS/coding in general and have encountered many challenges while trying to understand the AWS documentation, so my apologies if this is a simple fix.</p>