json

add

jsonArray.add(Json value);
jsonArray.add(String value);
jsonArray.add(Number value);
jsonArray.add(boolean value);

Appends a value to a JSON array.

add

jsonObject.add(String key, Json value);
jsonObject.add(String key, String value);
jsonObject.add(String key, Number value);
jsonObject.add(String key, boolean value);

Adds a key-value pair to a JSON object.

array

Json jsonArray = Json.array();

Creates an empty JSON array.

asArray

Converts a JSON array into a list of Json objects.

asBoolean

Extracts a boolean value from a JSON primitive.

asDouble

Extracts a double value from a JSON primitive.

asInt

Extracts an integer value from a JSON primitive.

asLong

Extracts a long value from a JSON primitive.

asString

Extracts a string value from a JSON primitive.

get

Retrieves a JSON element by key. Returns a JSON null object if the key doesn't exist.

has

Checks if a JSON object has a specific key.

object

Creates an empty JSON object.

parse

Parses a JSON-formatted string into a Json object.

keys

Extracts the keys from a json object.

toString

Returns the JSON object as a formatted string.

type

Returns the type of JSON element. [OBJECT, ARRAY, STRING, NUMBER, BOOLEAN, NULL]

Last updated