Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.

public final class Json

  1. Object
  2. Json

A small JSON reader and writer shared by the device and the server, for the JSON-RPC framing and EIP-712 documents the crypto packages exchange.

Objects read as LinkedHashMap<String, Object> in document order, arrays as ArrayList<Object>, strings as String, true/false as Boolean, null as null, and numbers as Long when integral and in range, UInt256 when integral, positive and beyond a long, and Double otherwise – a double would silently round a chain quantity.

Methods

public static Object parse(String json)Parses a JSON document.
public static String stringify(Object value)Writes a value as compact JSON.

Inherited methods

Method details

parse

public static Object parse(String json)
Parses a JSON document.

Throws

IllegalArgumentException
for malformed input, naming the offset

stringify

public static String stringify(Object value)
Writes a value as compact JSON. Accepts what parse produces plus any Number, byte[] (written as a 0x hex string), Object[] and any Map/List.