Raven B4
  • Main Page
  • Guide
    • Setup
    • Examples
  • Documentation
    • imports
    • events
    • client
    • entity
    • network
    • world
    • render
    • gl
    • modules
    • config
    • keybinds
    • inventory
    • tile entity
    • util
    • bridge
    • http
    • json
    • packets
    • objects
Powered by GitBook
On this page
  • add
  • add
  • array
  • asArray
  • asBoolean
  • asDouble
  • asInt
  • asLong
  • asString
  • get
  • has
  • object
  • parse
  • keys
  • toString
  • type
  1. Documentation

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

List<Json> arrayValues = jsonArray.asArray();

Converts a JSON array into a list of Json objects.

asBoolean

boolean flag = jsonPrimitive.asBoolean();

Extracts a boolean value from a JSON primitive.

asDouble

double decimal = jsonPrimitive.asDouble();

Extracts a double value from a JSON primitive.

asInt

int number = jsonPrimitive.asInt();

Extracts an integer value from a JSON primitive.

asLong

long number = jsonPrimitive.asLong();

Extracts a long value from a JSON primitive.

asString

String text = jsonPrimitive.asString();

Extracts a string value from a JSON primitive.

get

Json value = jsonObject.get(String key);

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

has

boolean hasKey = jsonObject.has(String key);

Checks if a JSON object has a specific key.

object

Json jsonObject = Json.object();

Creates an empty JSON object.

parse

Json json = Json.parse(String jsonString);

Parses a JSON-formatted string into a Json object.

keys

Set<String> keys = json.keys();

Extracts the keys from a json object.

toString

String jsonString = json.toString();

Returns the JSON object as a formatted string.

type

Json.Type type = json.type();

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

Last updated 1 month ago