Share via


JsonNull Class

public final class JsonNull
extends JsonElement

Model representing a JSON null value.

Method Summary

Modifier and Type Method and Description
static JsonNull fromJson(JsonReader jsonReader)

Deserializes a JSON null from a JsonReader.

static JsonNull getInstance()

Gets the instance of the JsonNull class.

boolean isNull()

Identifies if a JsonElement is of type JsonNull.

JsonWriter toJson(JsonWriter jsonWriter)
String toJsonString()

Methods inherited from JsonElement

Methods inherited from java.lang.Object

Method Details

fromJson

public static JsonNull fromJson(JsonReader jsonReader)

Deserializes a JSON null from a JsonReader.

If the JsonReader's current token is null, it is assumed the JsonReader hasn't begun reading and nextToken() will be called to begin reading.

After ensuring the JsonReader has begun reading, if the current token is not NULL, an IllegalStateException will be thrown. Otherwise, getInstance() will be called to return the deserialized JSON null.

Parameters:

jsonReader - The JsonReader to deserialize from.

Returns:

The deserialized JSON null.

Throws:

IOException

- If an error occurs while deserializing the JSON null.

getInstance

public static JsonNull getInstance()

Gets the instance of the JsonNull class.

Returns:

The JsonNull instance.

isNull

public boolean isNull()

Identifies if a JsonElement is of type JsonNull.

Overrides:

JsonNull.isNull()

Returns:

A boolean value of whether a JsonElement is null.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

toJsonString

public String toJsonString()

Throws:

Applies to