简体   繁体   中英

Not able to get value form JsonNode in java

I have a json string as below :

"{\"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

{"_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 ?

 JSONParser jsonParser = new JSONParser();
 JSONObject jsonObject = (JSONObject) jsonParser.parse(tmpStr);
 System.out.println("NodeValue:" + (String) jsonObject.get("event"));

you can try this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM