Go to NuGet.org

What is JsonLite?

JsonLite is a minimalistic JSON library that allows reading and writing JSON through an immutable AST.

JsonLite is available via NuGet https://www.nuget.org/packages/Json.Lite/

The source code for JsonLite is available via GitHub https://github.com/cosullivan/JsonLite/

How can it be used?

To create a JSON AST the simplest method is to use the static helper methods on the Json class.

var jsonArray = (JsonArray)Json.CreateAst("[ 1, 2, 3 ]");

foreach (var jsonValue in jsonArray)
{
    Console.WriteLine(jsonValue.Stringify());
}

A JSON AST can be created and then manipulated using a visitor pattern.

var jsonAst = new JsonObject(
    new JsonMember(
        "title", 
        new JsonString("Expert Oracle Database Artchitecture")),
    new JsonMember(
        "rating", 
        new JsonInteger(5)));

// output using a visitor
new JsonTextOutputVisitor(Console.Out).Output(jsonAst);

// output using the Stringify method
Console.WriteLine(jsonAst.Stringify());