title: Parse a file of JSON objects and convert to JSON array
body: <p>I have a file that contains JSON objects. I am trying to access the file using its URL in my java program to access its contents as follows.</p>
  
  <pre><code>URL url = new URL(Url);
  URLConnection request = url.openConnection();
  request.connect();
  JsonReader jr = new JsonReader(new InputStreamReader((InputStream) request.getContent()));
  jr.setLenient(true);
  JsonParser jp = new JsonParser();
  JsonElement root = jp.parse(jr);
  </code></pre>
  
  <p>I have to use the <code>jr.setLenient(true);</code> since the data is not a JSON object, but multiple JSON objects. But this approach does not help me to get all the JSON objects in the file. I am trying to get all the JSON objects, loop through each one of them and then save the data into my database. </p>
  
  <p>I have the sample of the type of data I receive at the following URL:
  <a href="http://d1kv7s9g8y3npv.cloudfront.net/testsite/files/doc-lib/2018/05/15/10/21/48/448/head/test3.txt" rel="nofollow noreferrer">Sample File</a></p>
  
  <p>Is there any way in which I can get all the objects in the file to perform the required operations.</p>
  
  <p>Also, I can manually save the data into a JSON array in a new file manually if nothing works, but there is no comma separation between each JSON object which is making it very difficult for me to parse the data.</p>
  
  <p>But each JSON object is a new line. So is there any way to parse it based on that.</p>