[英]Not able to get value form JsonNode in java
I have a json string as below : 我有一个json字符串,如下所示:
"{\"event\":\"PremiumAdsViews\",\"data\":{\"id\":12,\"category_id\":12,\"category_gid\":11,\"adStyle\":\"T\"}}"
When I am trying to convert it into JsonNode, I get the JsonNode as below and I am not able to access any value from get method of JsonNode 当我尝试将其转换为JsonNode时,得到的JsonNode如下所示,并且我无法从JsonNode的get方法访问任何值
{"_value":"{\"event\":\"PremiumAdsViews\",\"data\":{\"id\":12,\"category_id\":12,\"category_gid\":11,\"adStyle\":\"T\"}}"}
How can we parse the json string with double quotes on rear end into pure jsonNode ? 我们如何将后端带有双引号的json字符串解析为纯jsonNode?
JSONParser jsonParser = new JSONParser();
JSONObject jsonObject = (JSONObject) jsonParser.parse(tmpStr);
System.out.println("NodeValue:" + (String) jsonObject.get("event"));
you can try this 你可以试试这个
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.