0

I want to check Jsonnode value is present or not, As shown below myObj is an input. in this name is a key and "" is a value. I want to check if I get "" value then it should be go in else part. I tried by using following code but its not working.

JsonNode myObj = {name:""};

JsonNode node = myObj.get("name");

if(node != null && !node.isNull()){

// do some things with the item node

} else {

// do something else

}
1
  • In java, JsonNode myObj = {name: ""}; is not a legal statement. Commented Jan 18, 2023 at 9:13

1 Answer 1

0

Have you tried something like this:

node != null && !node.isNull() && node.textValue().isEmpty()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.