How to convert a String to JsonObject using gson library

后端 未结 9 1274
既然无缘
既然无缘 2020-11-30 23:45

Please advice how to convert a String to JsonObject using gson library.

What I unsuccesfully do:

String stri         


        
9条回答
  •  一生所求
    2020-12-01 00:20

    Note that as of Gson 2.8.6, instance method JsonParser.parse has been deprecated and replaced by static method JsonParser.parseString:

    JsonObject jsonObject = JsonParser.parseString(json).getAsJsonObject();
    

提交回复
热议问题