title: How to print the following JSON to pretty format?
body: <pre><code>{ "firstName":"John", "lastName":"Doe" },
  { "firstName":"Anna", "lastName":"Smith" },
  { "firstName":"Peter", "lastName":"Jones" }
  </code></pre>
  
  <p>This is my sample JSON, not having root tag. How can I take the whole JSON and iterate over it for each line and store it as a String object in Java and parse as a JSON Object? I tried this code. </p>
  
  <pre><code>String file = "D:\\employees.json";
          ObjectMapper mapper = new ObjectMapper();
          String data = "";
  
          data = new String(Files.readAllBytes(Paths.get(file)));
          System.out.println(data);
          Object json = mapper.readValue(data, employees.class);
          System.out.println("JSON -&gt; "+json);
          String indented = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(json);
          System.out.println(indented);
  </code></pre>
  
  <p>But here the json variable is holding only single row of the file, but I want the entire file to be printed in pretty format. How can I do that ? Here every line is a separate entity.</p>