Each of the JSON constructs can be mapped to a .Net construct as follows:
This JSON structure is implemented in .Net through three classes:
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.
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.
Each of these three classes override the
ToString() method to correctly output in a JSON format.
Implicit casts from
bool were created in
JsonValue to simplify coding and readability. Also, comparison operators were overridden for the