Package org.elkoserver.json

Utilities for working with JSON (JavaScript Object Notation) objects.

See:
          Description

Interface Summary
Encodable Implementing this interface enables an object's state to be output as a JSON object literal.
Referenceable Implementing this interface enables an object to be made referenceable in JSON messages.
 

Class Summary
EncodeControl Control object for regulating the behavior of an encoding operation.
JSONArray A parsed JSON array.
JSONLiteral A literal JSON string, representing either a message or an object, undergoing incremental construction.
JSONLiteralArray A literal JSON string, representing an array, undergoing incremental construction.
JSONObject A parsed JSON object.
Parser Parser to translate JSON strings into JSON objects.
 

Exception Summary
JSONDecodingException Thrown when a there is a problem of some sort interpreting the contents of a JSON object.
SyntaxError An exception to report a syntax error when parsing a JSON object or message.
 

Package org.elkoserver.json Description

Utilities for working with JSON (JavaScript Object Notation) objects.

The JavaScript Object Notation,or JSON (pronounced JAY-son, as in Jason And The Argonauts), is a subset of JavaScript's object literal notation. JavaScript (aka ECMAScript) is defined in ECMA Standard ECMA-404. It is more expressive than XML, easier for humans to read and write, easier for machines to parse and manipulate, and produces much smaller payloads. There is a complete JSON parser built into every modern web browser. This syntax is also supported, either directly or via libraries, by numerous other languages.

object-literal :
{ property-list }
{}
property-list :
identifier : value
string-literal : value
property-list , string-literal : value
value :
string-literal
numeric-literal
object-literal
array-literal
true
false
null
array-literal :
[ element-list ]
[]
element-list :
value
element-list , value

It is strictly illegal to put blank lines within a message, or to put a line terminating character inside a string literal.

Strings can be contained within double quotes "..." or single quotes '...'. UTF-8 encoding is used. Escapement uses the '\' character.

Numbers follow the C convention, except that octal notation is not permitted; a leading zero must be immediately followed by a decimal point or the letter x.

Elko uses JSON as its inter-system message syntax.

By convention, a JSON object which represents an inter-system message will have two string-valued properties to: and op:, which respectively designate the message target (i.e., the object the which the message is being directed) and the message verb. Similarly, a JSON object which represents a structure that is being transmitted as a message parameter or stored in an external persistent medium (e.g., a database) will have a string-valued property type: which denotes the kind of structure being represented.