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.
I have a json string (the stream of social network Qaiku). How can I
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As an example using Gson, you could do the following
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 objects called Table:
http://javastorage.wordpress.com/2011/03/31/how-to-decode-json-with-google-gson-library/
In order to do that the type needs to be specified as:
Gson is available here:
http://code.google.com/p/google-gson/