Class Json

java.lang.Object
com.codename1.crypto.encoding.Json

public final class Json extends Object

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.

  • 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(String) produces plus any Number, byte[] (written as a 0x hex string), Object[] and any Map/List.