A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://arduinojson.org/v7/api/jsonarray/isnull/ below:

JsonArray::isNull() | ArduinoJson 7

Description

JsonArray::isNull() tells whether the JsonArray points to an array or not.

You can use this function to:

  1. check if the array was successfully parsed, or
  2. check if the array was successfully allocated.

As an alternative, you can use the conversion to bool; for example, if(array) instead of if(!array.isNull())

Signature Return value

JsonArray::isNull() returns a bool that tells if the JsonArray points to something:

Examples

Example 1: parsing success:

JsonDocument doc;
deserializeJson(doc, "[1,2]");
JsonArray array = doc.as<JsonArray>();
Serial.println(array.isNull()); // false

Example 2: parsing failure:

JsonDocument doc;
deserializeJson(doc, "{1,2}");
JsonArray array = doc.as<JsonArray>();
Serial.println(array.isNull()); // true

Example 3: allocation success:

JsonDocument doc;
JsonArray array = doc.to<JsonArray>();
Serial.println(array.isNull()); // false

Example 4: allocation failure:

JsonDocument doc;
JsonArray array = doc.to<JsonArray>();
Serial.println(array.isNull()); // true
See also
  1. Home
  2. Version 7
  3. API
  4. JsonArray
  5. isNull()

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4