title: What is the difference between JsonReader and JsonParse in java
body: <p>I have seen that both of them is used to red key value pair of a json file. For example:</p>
  
  <p>The use of JsonParser to read key value of JSON file:</p>
  
  <pre><code>try {
      // read the json file
      FileReader reader = new FileReader(filePath);
  
      JSONParser jsonParser = new JSONParser();
      JSONObject jsonObject = (JSONObject) jsonParser.parse(reader);
  
      // get a String from the JSON object
      String firstName = (String) jsonObject.get("firstname");
      System.out.println("The first name is: " + firstName);
  
      // get a number from the JSON object
      long id =  (long) jsonObject.get("id");
      System.out.println("The id is: " + id);
  
      // get an array from the JSON object
      JSONArray lang= (JSONArray) jsonObject.get("languages");
  
      // take the elements of the json array
      for(int i=0; i&lt;lang.size(); i++){
          System.out.println("The " + i + " element of the array: "+lang.get(i));
      }
  
      Iterator i = lang.iterator();
  
      // take each value from the json array separately   
      while (i.hasNext()) {
          JSONObject innerObj = (JSONObject) i.next();
          System.out.println("language "+ innerObj.get("lang") +
              " with level " + innerObj.get("knowledge"));
      }
  
      // handle a structure into the json object
      JSONObject structure = (JSONObject) jsonObject.get("job");
      System.out.println("Into job structure, name: " + structure.get("name"));
  }
  </code></pre>
  
  <p>And the use of JsonReader to read key and value of JSON file:</p>
  
  <pre><code>try
  {
      InputStream isr=new FileInputStream("
          C:\\Users\\DELL\\Documents\\NetBeansProjects\\WaterNetwork
          \\web\\kusha.json"); 
      JsonReader jsr=Json.createReader(isr);
      JsonObject job=jsr.readObject();
      jsr.close();
      isr.close();
      System.out.println("Name is: "+job.getString("name"));
  }
  </code></pre>
  
  <p>I searched on net but not get any useful answers till now. So I want a full explanation on working and difference between JsonReader and JsonParser in java.</p>