1. Greg Dennis
  2. Manatee.Json

Wiki

Clone wiki

Manatee.Json / Architecture

This repository has been migrated to GitHub

ARCHITECTURE

The structure of JSON is quite simple. You can read about the language onjson.org.

Each of the JSON constructs can be mapped to a .Net construct as follows:

JSON .Net
object Dictionary
array List
boolean Boolean
numeric Double
string String

This JSON structure is implemented in .Net through three classes: JsonValue, JsonObject, and JsonArray.

The JsonValue class is a container class for all of the JSON types. In order for everything to remain strongly typed, the class exposes a property for each JSON type. To implement the JSON null value, the static member JsonValue.Null was created.

The JsonObject class is implemented as Dictionary<string, JsonValue>. As such it can be navigated and manipulated as any other dictionary instance would be.

Similarly to the JsonObject class, the JsonArray class is implemented as List<JsonValue>, which can be navigated and manipulated directly as a list instance.

NOTE Because of JsonObject's and JsonArray's inheritance structure, they are fully LINQ-compatible!

Each of these three classes override the ToString() method to correctly output in a JSON format.

Implicit casts from JsonObject, JsonArray, string, double, and bool were created in JsonValue to simplify coding and readability. Also, comparison operators were overridden for the JsonValue class. You can read more on these casts and operators on the Usage page.

Home | Architecture | Usage | Serialization | Schema | JSONPath | XML Conversion | Support

Updated