Json

Custom types

JsonResult

type JsonResult is bytes32;

Structs

JsonObject

struct JsonObject {
	string id
	string serialized
}

Functions

Ok(JsonObject value) → (JsonResult)

JsonError

Invalid() → (Error)

toJsonResult(Error self) → (JsonResult)

LibJsonObjectPointer

toJsonObject(Pointer self) → (JsonObject obj)

toJsonResult(Pointer self) → (JsonResult result)

toPointer(JsonObject obj) → (Pointer ptr)

LibJsonResult

isOk(JsonResult self) → (bool)

isError(JsonResult self) → (bool)

unwrap(JsonResult self) → (JsonObject val)

expect(JsonResult self, string err) → (JsonObject)

toError(JsonResult self) → (Error)

toValue(JsonResult self) → (JsonObject val)

toPointer(JsonResult self) → (Pointer)

json

getObject(JsonObject jsonObj, string key) → (bytes abiEncodedData)

Parses a json object struct by key and returns an ABI encoded value.

parse(JsonObject jsonObj) → (bytes abiEncodedData)

Parses a json object struct and returns an ABI encoded tuple.

isValid(string jsonObj) → (bool)

containsKey(JsonObject obj, string key) → (bool)

getUint(JsonObject obj, string key) → (uint256)

Parses the value of the key contained on jsonStr as uint256.

getUintArray(JsonObject obj, string key) → (uint256[])

Parses the value of the key contained on jsonStr as uint256[].

getInt(JsonObject obj, string key) → (int256)

Parses the value of the key contained on jsonStr as int256.

getIntArray(JsonObject obj, string key) → (int256[])

Parses the value of the key contained on jsonStr as int256[].

getBool(JsonObject obj, string key) → (bool)

Parses the value of the key contained on jsonStr as bool.

getBoolArray(JsonObject obj, string key) → (bool[])

Parses the value of the key contained on jsonStr as bool[].

getAddress(JsonObject obj, string key) → (address)

Parses the value of the key contained on jsonStr as address.

getAddressArray(JsonObject obj, string key) → (address[])

Parses the value of the key contained on jsonStr as address.

getString(JsonObject obj, string key) → (string)

Parses the value of the key contained on jsonStr as string.

getStringArray(JsonObject obj, string key) → (string[])

Parses the value of the key contained on jsonStr as string[].

getBytes(JsonObject obj, string key) → (bytes)

Parses the value of the key contained on jsonStr as bytes.

getBytesArray(JsonObject obj, string key) → (bytes[])

Parses the value of the key contained on jsonStr as bytes[].

getBytes32(JsonObject obj, string key) → (bytes32)

Parses the value of the key contained on jsonStr as bytes32.

getBytes32Array(JsonObject obj, string key) → (bytes32[])

Parses the value of the key contained on jsonStr as bytes32[].

getKeys(JsonObject obj, string key) → (string[])

getKeys(JsonObject obj) → (string[])

create() → (JsonObject)

Creates a new JsonObject struct.

create(string obj) → (JsonResult)

Creates a new JsonObject struct.

set(JsonObject obj, string key, bool value) → (JsonObject res)

Serializes and sets the key and value for the provided json object.

set(JsonObject obj, string key, uint256 value) → (JsonObject res)

Serializes and sets the key and value for the provided json object.

set(JsonObject obj, string key, int256 value) → (JsonObject res)

Serializes and sets the key and value for the provided json object.

set(JsonObject obj, string key, address value) → (JsonObject res)

Serializes and sets the key and value for the provided json object.

set(JsonObject obj, string key, bytes32 value) → (JsonObject res)

Serializes and sets the key and value for the provided json object.

set(JsonObject obj, string key, string value) → (JsonObject res)

Serializes and sets the key and value for the provided json object.

set(JsonObject obj, string key, bytes value) → (JsonObject res)

Serializes and sets the key and value for the provided json object.

set(JsonObject obj, string key, bool[] values) → (JsonObject res)

Serializes and sets the key and value for the provided json object.

set(JsonObject obj, string key, uint256[] values) → (JsonObject res)

Serializes and sets the key and value for the provided json object.

set(JsonObject obj, string key, int256[] values) → (JsonObject res)

Serializes and sets the key and value for the provided json object.

set(JsonObject obj, string key, address[] values) → (JsonObject res)

Serializes and sets the key and value for the provided json object.

set(JsonObject obj, string key, bytes32[] values) → (JsonObject res)

Serializes and sets the key and value for the provided json object.

set(JsonObject obj, string key, string[] values) → (JsonObject res)

Serializes and sets the key and value for the provided json object.

set(JsonObject obj, string key, bytes[] values) → (JsonObject res)

Serializes and sets the key and value for the provided json object.

set(JsonObject obj, string key, JsonObject value) → (JsonObject res)

Serializes and sets the key and value for the provided json object.

write(JsonObject obj, string path)

Writes a JsonObject struct to a file.

write(JsonObject obj, string path, string key)

Writes a JsonObject struct to an existing json file modifying only a specific key.