How to decode a json string with gson in java?
问题 I have a json string (the stream of social network Qaiku). How can I decode it in Java? I've searched but any results work for me. Thank you. 回答1: As an example using Gson, you could do the following Gson gson = new Gson(); gson.fromJson(value, type); where value is your encoded value. The trick comes with the second parameter - the type. You need to know what your decoding and what Java type that JSON will end in. The following example shows decoding a JSON string into a list of domain