CleverModels icon indicating copy to clipboard operation
CleverModels copied to clipboard

JSON starting with array vs Object , no change in the pojo generated?

Open LOG-TAG opened this issue 10 years ago • 1 comments

case1:

[ { "rollno": "001553244373", "app_dob": "1992-10-25", "result": "Contains no info" } ]

case2:

{
    "certno": "001439924373",
    "app_dob": "1992-10-25",
    "result": "Contains no information"
}

How come for both case1,2 returned same POJO's ? case one starts with JSON array , case2 starts with Json object!!

YourClass yourClass = gson.fromJson(json, case2.class); //success

YourClass yourClass = gson.fromJson(json, case1.class); //fails

LOG-TAG avatar Apr 14 '14 08:04 LOG-TAG

Thanks for reporting this.

Can you show me the case1 generated class ?

But, by the way, i currently have little time to maintain this. But, if you provide a fix, send me a pull request and i'll update it.

ehanoc avatar Apr 14 '14 09:04 ehanoc