Name

isNull()

Class

JSONObject

Description

Determines if the value associated with the key is null, that is has no defined value (false) or if it has a value (true).

Examples

  • JSONObject json;
    
    void setup() {
    
      json = new JSONObject();
      json.setInt("id", 0);
      json.setString("species", null);
    
      if (json.isNull("species") == true) {
        println("The species is undefined");
      } else {
        println("The ID is " + json.getString("species"));
      }
    }
    

Syntax

  • .isNull(key)

Parameters

  • key(String)A key string.

Return

  • boolean