JSON only allows one top level value?

Viewed 13315

I have the following Java Object:

public class PersonDetails {
    private Person person;
    private List<Relative> relatives;

    public PersonDetails() {};

    //getters and setters

    }

I am trying to create Stub JSON for this so that I can parse it to a Java Object using GSON.

When I try to use the below JSON, but I get the error:

JSON only allows one top level value

How can I alter my JSON to make it valid?

My Current JSON:

{
    "Person": {

        "id": "123",
        "name: "stubName"
    },
    [
     "Relative": {

        "name": "relative1",
        "relation: "mother"

     }

    ]
}
3 Answers
Related