Contains everything required to parse and serialise JSON data.

Sample usage for parsing and accessing JSON:

String getAuthor(String json){
    value parsedJson = parse(json);
    if(is Object parsedJson){
        if(is String author = parsedJson.get("author")){
            return author;
        }
    }
    throw Exception("Invalid JSON data");
}

Sample usage for generating JSON data:

String getJSON(){
    value json = Object{
        "name" -> "Introduction to Ceylon",
        "authors" -> Array{
            "Stef Epardaud",
            "Emmanuel Bernard"
        }
    };
    return json.string;
}
By: Stéphane Épardaud
Packages
ceylon.json

A JSON parser / serialiser

A JSON parser / serialiser

By: Stéphane Épardaud
Attributes
nil
shared nil nil

The singleton that represents the null value in JSON`.

Methods
parse
shared Object parse(String str)

Parses a JSON string into a JSON Object

Throws:
  • Exception

    If the JSON string is invalid

By: Stéphane Épardaud
Classes
Array
shared Array

Represents a JSON Array

NullInstance
shared abstract NullInstance

Represents the type of the null value in JSON.

Object
shared Object

Represents a JSON Object

Printer
shared abstract Printer

A JSON Printer

StringPrinter

A JSON Printer that prints to a String

nil
shared nil

The singleton that represents the null value in JSON`.

Exceptions
InvalidTypeException