title: How to read JSON file present in S3 using java
body: <p>I have a JSON file url present in S3 which I need to parse and extract information out of it. How do I do that in java?</p>
  
  <p>I have looked into some of the <a href="https://stackoverflow.com/questions/40995251/reading-an-json-file-from-s3-using-python-boto3">solutions</a> mainly in Python but not able to do that in Java.</p>
  
  <p>I can read the content using</p>
  
  <pre><code>S3Object object = s3Client.getObject(new GetObjectRequest(bucketName, key));
  InputStream objectData = object.getObjectContent();
  </code></pre>
  
  <p>but I do not want to download the file and keep it. I just need to be able to parse this JSON file using <a href="https://github.com/google/gson" rel="noreferrer">Gson</a>.</p>
  
  <p>How do I achieve this?</p>