title: JSON Parsing Using Jackson Library
body: <p>My <code>JSON</code> data looks like this:</p>
  
  <pre><code>[
  {
    "id":1,
    "ad_name":"Test Ad",
    "ad_text":"This is my ad text"
  },
  {
    "id":2,
    "ad_name":"Test Ad",
    "ad_text":"This is my ad text"
  },
  {
    "id":3,
    "ad_name":"Test Ad",
    "ad_text":"This is my ad text"
  },
  {
    "id":4,
    "ad_name":"Test Ad",
    "ad_text":"This is my ad text"
  },
  {
    "id":5,
    "ad_name":"Test Ad",
    "ad_text":"This is my ad text"
  }
  ]
  </code></pre>
  
  <p>I'm using Jackson Library to parse it, here is my code for that:</p>
  
  <pre><code>try {
          jParser = jfactory.createParser(array);
  
          while (jParser.nextToken() != JsonToken.END_ARRAY) {
  
              String fieldname = jParser.getCurrentName();
  
              if (fieldname != null) {
  
                  if ("id".equals(fieldname)) {
                      jParser.nextToken();
                      if (jParser.getText() != null)
                          id = jParser.getText();
  
                      System.out.println(id);
                  }
  
                  if ("ad_name".equals(fieldname)) {
                      jParser.nextToken();
                      if (jParser.getText() != null)
                          ad_name = jParser.getText();
  
                      System.out.println(ad_name);
                  }
  
                  if ("ad_text".equals(fieldname)) {
                      jParser.nextToken();
                      if (jParser.getText() != null)
                          ad_text = jParser.getText();
  
                      System.out.println(ad_text);
                  }
              }
  
          }
  
          jParser.close();
          return adsList;
      } catch (Exception e) {
          e.printStackTrace();
      }
  </code></pre>
  
  <p>My parsing and all stuff are working fine. But when I'm printing values in logs, I'm getting duplicate values, means every <code>JSONObject</code> is printing two times.</p>
  
  <p>What am I missing here? Any kind of help will be appreciated.</p>