D Programming Language 2.0

# std.json

JavaScript Object Notation

License:
Boost License 1.0.

Authors:
Jeremie Pelletier

References:
http://json.org/

Source:
std/json.d

enum JSON_TYPE: byte;
  JSON type enumeration

  STRING
  INTEGER
    Indicates the type of a JSONValue.

  UINTEGER
  FLOAT
  OBJECT
  ARRAY
  TRUE
  FALSE
  NULL
    integers > 2^63-1

struct JSONValue;
  JSON value node

  string str;
    Value when type is JSON_TYPE.STRING

  long integer;
    Value when type is JSON_TYPE.INTEGER

  ulong uinteger;
    Value when type is JSON_TYPE.UINTEGER

  real floating;
    Value when type is JSON_TYPE.FLOAT

  JSONValue[string] object;
    Value when type is JSON_TYPE.OBJECT

  JSONValue[] array;
    Value when type is JSON_TYPE.ARRAY

  JSON_TYPE type;
    Specifies the type of the value stored in this structure.

  ref JSONValue opIndex(size_t i);
    array syntax for json arrays

  ref JSONValue opIndex(string k);
    hash syntax for json objects

JSONValue parseJSON(T)(T json, int maxDepth = -1) if (isInputRange!T);
  Parses a serialized string and returns a tree of JSON values.

string toJSON(in JSONValue* root, in bool pretty = false);
  Takes a tree of JSON values and returns the serialized string.

  If pretty is false no whitespaces are generated. If pretty is true serialized string is formatted to be human-readable. No exact formatting layout is guaranteed in the latter case.

class JSONException: object.Exception;
  Exception thrown on JSON errors

Copyright Jeremie Pelletier 2008 - 2009. | Page generated by Ddoc.