通过String创建Gson / Json对象

时间:2016-09-08 16:54:14

标签: android json gson

我试图转换此字符串:

{"状态":200,"消息":" OK""响应" {"导致&#34 ;:1,"时间":0.29773306846619,"值":[]}}

到Json OBJ,为了能够更好地读取值,我在某处读到了我可以使用Gson库,但我不知道如何。

1 个答案:

答案 0 :(得分:2)

您不需要使用GSON。 Android内置了JSON解析。只需将您的字符串传递给构造函数。

JSONObject jObject = new JSONObject(myString);

Here are the docs for JSONObject.