[英]Nested JsonObject to String
I want to convert the value of 'points' to a string.我想将 'points' 的值转换为字符串。 Initially, it is an Object.最初,它是 Object。
{
"note": "testing",
"Area": "India",
"workId": "21390",
"points": {
"value1": [
[
[1, 2],
[3, 4]
]
],
"value2": 5,
"value3": {
"q": 1111,
"l": 0011
}
}
}
I am trying to use the below code but it giving me "deserialize instance of java.lang.String"我正在尝试使用下面的代码,但它给了我“反序列化 java.lang.String 的实例”
if (Json_object.has("points"))
{
String string = Json_object.getJSONObject("points").toString();
payload.put("points",string);
/*more code */
}
Please Help!请帮忙!
First of all, this is not an approach to deal with a JSON object.首先,这不是处理 JSON object 的方法。
This is a reusable and straightforward way.这是一种可重用且直接的方式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.