public class Json
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Json.JsonHashMap
A LinkedHashMap intended to hold JSON-structured data, with a
Json.JsonHashMap.toString() method
that produces JSON text. |
Modifier and Type | Method and Description |
---|---|
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 Json.JsonHashMap |
decodeJSON(java.io.Reader din,
PortConnector portConnector,
int[] charCount,
Json.JsonHashMap answer) |
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.
|
public static java.util.Map<java.lang.String,java.lang.Object> decodeJSON(java.io.Reader din, PortConnector portConnector) throws java.io.IOException
din
- Reader to get the JSON hierarchy fromportConnector
- PortConnector to inform of starting and ending reading a JSON object, or null
if no one is to be informedjava.io.IOException
- if the Reader cannot be read to the end of the JSON objectpublic static Json.JsonHashMap decodeJSON(java.io.Reader din, PortConnector portConnector, int[] charCount, Json.JsonHashMap answer) throws java.io.IOException
java.io.IOException
public static void encodeJSON(java.util.Map<java.lang.String,java.lang.Object> data, java.io.PrintWriter pw)
data
- the top object in the JSON hierarchy, represented as a Map with attribute name keys and attribute valuespw
- PrintWriter to write the generated string representation to