Jackson JsonMappingException: Can not deserialize instance

Can not deserialize instance of java.util.ArrayList out of START_OBJECT token

The key words here are ArrayList and START_OBJECT token. You cannot deserialize a single object into an array of objects. Try to make sense of doing that and you'll understand why.

You can only deserialize an array of JSON objects into an array or collection of POJO's. Note that, whereas a JSON object is delimited by { } braces, an array is delimited by [ ] brackets, with some number of objects inside of it.


  1. Remove the Constructor in Entries & Phone

  2. GetEntries results = mapper.readValue(new URL("http://collegewires.com/android/jacksoncw.json"), GetEntries.class);

  3. Entries seems to be a parameter in your JSON.

GetEntries.java

package com.collegewires.jackson;

import java.util.List;

public class GetEntries{
    private List<Entries> entries;

    public List<Entries> getEntries(){
        return this.entries;
    }
    public void setEntries(List<Entries> entries){
        this.entries = entries;
    }
}

Entries.java

package com.collegewires.jackson;

import java.util.List;

public class Entries{
    private String address;
    private String email;
    private String gender;
    private String id;
    private String name;
    private Phone phone;

    public String getAddress(){
        return this.address;
    }
    public void setAddress(String address){
        this.address = address;
    }
    public String getEmail(){
        return this.email;
    }
    public void setEmail(String email){
        this.email = email;
    }
    public String getGender(){
        return this.gender;
    }
    public void setGender(String gender){
        this.gender = gender;
    }
    public String getId(){
        return this.id;
    }
    public void setId(String id){
        this.id = id;
    }
    public String getName(){
        return this.name;
    }
    public void setName(String name){
        this.name = name;
    }
    public Phone getPhone(){
        return this.phone;
    }
    public void setPhone(Phone phone){
        this.phone = phone;
    }
}

Phone.java

package com.collegewires.jackson;

import java.util.List;

public class Phone{
    private String home;
    private String mobile;
    private String office;

    public String getHome(){
        return this.home;
    }
    public void setHome(String home){
        this.home = home;
    }
    public String getMobile(){
        return this.mobile;
    }
    public void setMobile(String mobile){
        this.mobile = mobile;
    }
    public String getOffice(){
        return this.office;
    }
    public void setOffice(String office){
        this.office = office;
    }
}