title: JSON returning null values on response
body: <p>My <code>response</code> is giving me <code>null</code> values, but when I'm running the same in <code>fiddler</code>, I get a lot of data. I have written very less code and used online tools to generate my code. I wonder where I am messing up.</p>
  
  <pre><code>    Publications response = null ;
      // First open URL connection (using JDK; similar with other libs)
      try {
          URL url = new URL(
                  "http://myserver:myport/Mobile/GetPublications");
          HttpURLConnection connection = (HttpURLConnection)url.openConnection() ;
          connection.setDoInput(true);
          connection.setDoOutput(true);
          connection.setRequestMethod("POST") ;
          connection.setRequestProperty("Content-Type", "application/json") ;
          // and other configuration if you want, timeouts etc
          // then send JSON request
          Publications request = new Publications(); // POJO with getters or public fields
          ObjectMapper mapper = new ObjectMapper(); 
          mapper.writeValue(connection.getOutputStream(), request);
          // and read response
          response = mapper.readValue(
                  connection.getInputStream(), Publications.class);
      } catch (JsonGenerationException e) {
          e.printStackTrace();
          fail() ;
      } catch (JsonMappingException e) {
          e.printStackTrace();
          fail() ;
      } catch (IOException e) {
          e.printStackTrace();
          fail() ;
      }
      assertNotNull(response) ;
      assertTrue(response.getPublicationInfo() != null) ;
  //      assertTrue(response.getPublicationInfo().size() &gt; 0);
  //      assertNotNull( ((PublicationInfo)response.getPublicationInfo().get(0)).getPublicationTitle() != null) ;
  </code></pre>
  
  <p>And the Publications POJO is</p>
  
  <pre><code>import com.fasterxml.jackson.*
  
  @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
  @Generated("com.googlecode.jsonschema2pojo")
  @JsonPropertyOrder({ "ErrorInfo", "PublicationInfo" })
  public class Publications {
  
  @JsonProperty("ErrorInfo")
  private Object ErrorInfo;
  
  @JsonProperty("PublicationInfo")
  private List&lt;PublicationInfo&gt; PublicationInfo = new ArrayList&lt;PublicationInfo&gt;();
  private Map&lt;String, Object&gt; additionalProperties = new HashMap&lt;String, Object&gt;();
  
  @JsonProperty("ErrorInfo")
  public Object getErrorInfo() {
      return ErrorInfo;
  }
  
  @JsonProperty("ErrorInfo")
  public void setErrorInfo(Object ErrorInfo) {
      this.ErrorInfo = ErrorInfo;
  }
  
  @JsonProperty("PublicationInfo")
  public List&lt;PublicationInfo&gt; getPublicationInfo() {
      return PublicationInfo;
  }
  
  @JsonProperty("PublicationInfo")
  public void setPublicationInfo(
          List&lt;PublicationInfo&gt; PublicationInfo) {
      this.PublicationInfo = PublicationInfo;
  }
  
  @JsonAnyGetter
  public Map&lt;String, Object&gt; getAdditionalProperties() {
      return this.additionalProperties;
  }
  
  @JsonAnySetter
  public void setAdditionalProperties(String name, Object value) {
      this.additionalProperties.put(name, value);
  }
  }
  </code></pre>
  
  <p>I get a test case failure at <code>assertTrue(response.getPublicationInfo().size() &gt; 0);</code>. But fiddler returns the following</p>
  
  <pre><code>{
  "SpecialPublications": {
      "ErrorInfo": null,
      "SpecialPublicationInfo": [
          {
              "Date": "2/3/2010",
              "URL": "SOME URL HERE",
              "Description": "So much to do so less time."
          },
          {
              "Date": "2/4/2010",
              "URL": "SOME MORE URL HERE",
              "Description": "I need more time"
          }
     ]
  }
  }
  </code></pre>