Click or drag to resize

JSONFormatter Class

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
The JSONFormatter allows classes that implement IJSONSerializable to be converted into strings. The JSONFormatter also allows the strings to be converted back into object form.
Inheritance Hierarchy
SystemObject
  Telogis.GeoBase.SerializationJSONFormatter

Namespace:  Telogis.GeoBase.Serialization
Assembly:  geobase.net (in geobase.net.dll) Version: 4.99.0.0
Syntax
public static class JSONFormatter

The JSONFormatter type exposes the following members.

Methods
Examples
C#
class Item : IJSONSerializable {

    public int Value { get; set; }

    public string JSONName {
        get { return "Item"; }
    }

    public JSONObject ToJSON() {
        JSONObject formatter = new JSONObject();
        formatter["value"] = Value;
        return formatter;
    }

    public void FromJSON(JSONObject source) {
        Value = source.Get<int>("value", 0);
    }
}

public static int Main(string[] args) {
    Item originalItem = new Item {
        Value = 2
    };

    string jsonString = JSONFormatter.Serialize(originalItem);
    Item item = JSONFormatter.Deserialize<Item>(jsonString);
}
See Also