Gson, how to deserialize array or empty string

前端 未结 6 2254
长情又很酷
长情又很酷 2020-12-06 20:08

I trying to deserialize this json to array of objects:

[{
    \"name\": \"item 1\",
    \"tags\": [\"tag1\"]
},
{
    \"name\": \"item 2\",
    \"tags\": [\"         


        
6条回答
  •  日久生厌
    2020-12-06 20:46

    You are mixing datatypes. You cant have both an Array and a string. Change

    "tags": ""
    

    to

    "tags": null
    

    and you are good to go.

提交回复
热议问题