Module aeonics.core
Package aeonics.util

Class Json


  • public class Json
    extends java.lang.Object
    Fault tolerant JSON encoder/decoder
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Data decode​(java.lang.String json)
      Decodes the input json into a data structure
      static java.lang.String encode​(Data data)
      Encodes the specified object in JSON.
      static java.lang.String encode​(Exportable exportable)
      Encodes the specified object in JSON.
      static java.lang.String encode​(java.lang.Object object)
      Encodes the specified object in JSON.
      static java.lang.String escape​(java.lang.String s)
      Escapes special characters for JSON output
      static java.lang.String unescape​(java.lang.String s)
      Unescapes special characters from encoded JSON input
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • encode

        public static java.lang.String encode​(java.lang.Object object)
        Encodes the specified object in JSON. The object is first wrapped in a data structure then converted toString().
        Parameters:
        object - the object to convert to JSON
        Returns:
        a JSON string representation of the object
        See Also:
        Data
      • encode

        public static java.lang.String encode​(Exportable exportable)
        Encodes the specified object in JSON. The object is first Exportable.export() then converted toString().
        Parameters:
        exportable - the object to convert to JSON
        Returns:
        a JSON string representation of the object
      • encode

        public static java.lang.String encode​(Data data)
        Encodes the specified object in JSON. The object converted toString().
        Parameters:
        data - the object to convert to JSON
        Returns:
        a JSON string representation of the object
      • escape

        public static java.lang.String escape​(java.lang.String s)
        Escapes special characters for JSON output
        Parameters:
        s - the text to escape
        Returns:
        the escaped text
      • unescape

        public static java.lang.String unescape​(java.lang.String s)
        Unescapes special characters from encoded JSON input
        Parameters:
        s - the text to unescape
        Returns:
        the unescaped text
      • decode

        public static Data decode​(java.lang.String json)
        Decodes the input json into a data structure
        Parameters:
        json - the input text
        Returns:
        the parsed data