Note that there are some explanatory texts on larger screens.

plurals
  1. POJackson 2 deserialization
    primarykey
    data
    text
    <p>I have a problem using google geocoding api. For example, with this url <a href="http://maps.google.com/maps/api/geocode/json?latlng=47.3195254,5.0430687&amp;sensor=true" rel="nofollow">http://maps.google.com/maps/api/geocode/json?latlng=47.3195254,5.0430687&amp;sensor=true</a>, I want to parse the json with jackson 2 to create the POJO.</p> <p>So my class is</p> <pre><code>public class GeocoderResult { @JsonProperty("results") private List&lt;GeocoderGoog&gt; geocoder; @JsonProperty("status") private String status; public List&lt;GeocoderGoog&gt; getGeocoder() { return geocoder; } public String getStatus() { return status; } } </code></pre> <p>To deserialize json, I use </p> <pre><code>HttpURLConnection connection = (HttpURLConnection) new URL(baseUrl).openConnection(); ObjectMapper mapper = new ObjectMapper(); // disable exceptions when there is unknown properties mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); int statusCode = connection.getResponseCode(); Log.d(Constants.D_TAG, "Status : "+statusCode); if (statusCode == HttpURLConnection.HTTP_OK) { // 200 InputStream is = new BufferedInputStream(connection.getInputStream()); status = (Status) mapper.readValue(is, GeocoderResult.class); } </code></pre> <p>I have the following error :</p> <pre><code>09:38:42.737 Thread-24889 An exception occurred during request network execution :Unexpected close marker '}': expected ']' (for ROOT starting at [Source: java.io.BufferedInputStream@428a1840; line: 1, column: 0]) at [Source: java.io.BufferedInputStream@428a1840; line: 2, column: 14] com.fasterxml.jackson.core.JsonParseException: Unexpected close marker '}': expected ']' (for ROOT starting at [Source: java.io.BufferedInputStream@428a1840; line: 1, column: 0]) </code></pre> <p>I don't understand where is the problem ...</p> <p>ps : I use jackson-core, jackson-databind and jackson-annotations 2.1.4</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload