twarzo
twarzo

Reputation: 113

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 ?

Upvotes: 0

Views: 378

Answers (1)

BEN SEBASTIAN
BEN SEBASTIAN

Reputation: 106

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

you can try this

Upvotes: 1

Related Questions