当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Deserialize array of integers using gson

问题描述:

this must be a stupid question, but how to deserialize this? (using Gson)

{"Requisitions":[129,127,124,46,40,39,38,37,36,35,34,33]}

网友答案:
class RequisitionsClass {
    int[] Requisitions;
}    

RequisitionsClass requisition = new Gson().fromJson(json, RequisitionsClass.class);

then you can access the array like this:

requisition.Requisitions[0]
分享给朋友:
您可能感兴趣的文章:
随机阅读: