GSON - 从字符串中获取JSON值
- 论坛
- GSON - 从字符串中获取JSON值
6 浏览
GSON - 从字符串中获取JSON值
我正在尝试使用GSON库解析JSON字符串"{'test': '100.00'}",以获取值:100.00
。我的代码如下:
String myJSONString = "{'test': '100.00'}"; JsonObject jobj = new Gson().fromJson(myJSONString, JsonObject.class); String result = jobj.get("test").toString(); System.out.println(result);
我的结果看起来是这样的:"100.00"
,但是我只需要100.00
,不带引号。如何实现这一点?