Search Results for

    Show / Hide Table of Contents

    Class GenericJsonData

    • C#
    • Visual Basic
    [Serializable]
    [JsonObject]
    public class GenericJsonData
    <Serializable>
    <JsonObject>
    Public Class GenericJsonData
    Inheritance
    System.Object
    GenericJsonData
    JsonRequest
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: HomeSeer.PluginSdk.Features
    Assembly: PluginSdk.dll


    Generic data collection used as a JSON object. Takes the form of {"data":{}}. See JsonRequest, JsonResponse, and JsonError for basic implementation


    Constructors

    View Source

    GenericJsonData()

    Create a new GenericJsonData object

    Declaration
    • C#
    • Visual Basic
    [JsonConstructor]
    public GenericJsonData()
    <JsonConstructor>
    Public Sub New
    View Source

    GenericJsonData(Dictionary<String, String>)

    Create a new GenericJsonData object with data

    Declaration
    • C#
    • Visual Basic
    public GenericJsonData(Dictionary<string, string> data)
    Public Sub New(data As Dictionary(Of String, String))
    Parameters
    Type Name Description
    System.Collections.Generic.Dictionary<System.String, System.String> data

    Properties

    View Source

    Data

    A collection of data keys and values

    Declaration
    • C#
    • Visual Basic
    [JsonProperty("data")]
    public Dictionary<string, string> Data { get; set; }
    <JsonProperty("data")>
    Public Property Data As Dictionary(Of String, String)
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.String>

    Methods

    View Source

    Clear()

    Remove all data from the collection

    Declaration
    • C#
    • Visual Basic
    public void Clear()
    Public Sub Clear
    View Source

    Contains(String)

    Determine if a key exists in the data collection

    Declaration
    • C#
    • Visual Basic
    public bool Contains(string key)
    Public Function Contains(key As String) As Boolean
    Parameters
    Type Name Description
    System.String key

    The key to look for

    Returns
    Type Description
    System.Boolean

    TRUE if the key exists in the collection, FALSE if it does not

    View Source

    FromJson(String)

    Deserialize a GenericJsonData object from JSON

    Declaration
    • C#
    • Visual Basic
    public static GenericJsonData FromJson(string json)
    Public Shared Function FromJson(json As String) As GenericJsonData
    Parameters
    Type Name Description
    System.String json

    JSON string containing a serialized GenericJsonData

    Returns
    Type Description
    GenericJsonData

    A GenericJsonData object

    View Source

    Get(String)

    Get the data value for a key

    Declaration
    • C#
    • Visual Basic
    public string Get(string key)
    Public Function Get(key As String) As String
    Parameters
    Type Name Description
    System.String key

    The key for the data to get

    Returns
    Type Description
    System.String

    The data value corresponding to the key

    View Source

    Put(String, String)

    Put a value in the data collection

    Declaration
    • C#
    • Visual Basic
    public void Put(string key, string value)
    Public Sub Put(key As String, value As String)
    Parameters
    Type Name Description
    System.String key

    The key to map the data with

    System.String value

    The data value to save

    View Source

    Remove(String)

    Remove the value associated with a key from the data

    Declaration
    • C#
    • Visual Basic
    public void Remove(string key)
    Public Sub Remove(key As String)
    Parameters
    Type Name Description
    System.String key

    The key to remove from the data

    View Source

    ToJson()

    Serialize the data to a JSON string

    Declaration
    • C#
    • Visual Basic
    public string ToJson()
    Public Function ToJson As String
    Returns
    Type Description
    System.String

    A JSON string

    • View Source
    In This Article
    Back to top HomeSeer Technologies