How to deal with "null" variables in JSON file?

edited July 2015 in How To...

This is an excerpt of a JSON file I'm working on with Processing

"headlineReview":{
         "text":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus gravida dignissim neque, eu scelerisque lacus.",
         "author":"Lorem ipsum"
      },
      "classicalReview":null,
      "classicalReviewUri":null,

Sometimes the "headlineReview" is null (like "classicalReview") and some other times it contains a String (as shown above). How do I check if that particular field is null? I already tried with .getString(), .getBoolean() etc... but I always get an error so I cannot run an if statement.

Answers

Sign In or Register to comment.