libperun

Class std.json.JSON

Synopsis

public abstract class JSON

Represents any JSON value, and also provides static methods to parse JSON.

Fields

Constructors

Methods

protected abstract void outputTo(OutputStream strm,int depth);

Encode this value and write to the specified output stream.

Arguments
strmThe output stream.
depthCurrent depth (for indentation).
public final void outputTo(OutputStream strm);

Encode this value and write to the specified output stream.

public static String escapeString(String str);

Escape a string for writing to a JSON file. This does NOT add quotes to each end!

public static JSON parse(InputStream strm);

Parse JSON from the specified stream, and return the resulting JSON object. This might be null if the stream simply says null.

Arguments
strmThe input stream to read from.
Returns

A JSON instance referring to the parsed data.

Throws
std.json.JSONErrorIf the input data is invalid.