Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ka2ddo.yaac.util
Class Json

    java.lang.Object
      org.ka2ddo.yaac.util.Json

    public class Json

extends java.lang.Object

This class is a limited-function decoder and encoder for JSON messages, sufficient to support the implementation used by gpsd.

Method Summary
`static java.util.Map<java.lang.String,java.lang.Object>` | `decodeJSON(java.io.Reader din, PortConnector portConnector)` Read a JSON object hierarchy from the specified text Reader.
`static void` | `encodeJSON(java.util.Map<java.lang.String,java.lang.Object> data, java.io.PrintWriter pw)` Convert a JSON object hierarchy into a JavaScript-compatible string in JSON syntax.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### decodeJSON

    public static java.util.Map<java.lang.String,java.lang.Object> decodeJSON(java.io.Reader din,
                                                                              PortConnector portConnector)
                                                                       throws java.io.IOException

  Read a JSON object hierarchy from the specified text Reader.

  Parameters:
    `din` - Reader to get the JSON hierarchy from
    `portConnector` - PortConnector to inform of starting and ending reading a JSON object, or null if no one is to be informed
  Returns:
    a Map of JSON attribute names to attribute values (note that some values can be other maps representing sub-ordinate JSON objects)
  Throws:
    `java.io.IOException` - if the Reader cannot be read to the end of the JSON object

### encodeJSON

    public static void encodeJSON(java.util.Map<java.lang.String,java.lang.Object> data,
                                  java.io.PrintWriter pw)
                           throws java.io.IOException

  Convert a JSON object hierarchy into a JavaScript-compatible string in JSON syntax.

  Parameters:
    `data` - the top object in the JSON hierarchy, represented as a Map with attribute name keys and attribute values
    `pw` - PrintWriter to write the generated string representation to
  Throws:
    `java.io.IOException` - if the PrintWriter could to be written to for any reason

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD