Changwei Yao
Changwei Yao

Reputation: 13101

google-httpclient JSON definition

When the JSON is:

{
     "result":200,
     "data", "my data"
}

The definition of the class can be:

class HttpResult
{
    @Key
    public int result;

    @Key
     public String data;

}

When the JSON root is a array and has no Key:

[
    {
        "result:200",
        "data":"data1"
    },
    {
        "result":404,
        "data":"data2"
    }
]

Then the definition of the class is?

Upvotes: 0

Views: 206

Answers (1)

ThinkingStiff
ThinkingStiff

Reputation: 65351

Same class definition, it's just a Collection of them instead of one.

Upvotes: 1

Related Questions