• Facebook
  • Twitter
  • Youtube
  • LinedIn
  • RSS
  • Docs
  • Comparisons
  • Blogs
  • Download
  • Contact Us
Download
Show / Hide Table of Contents

Class JsonObject

Class represents JObject in JSON standards.

Inheritance
System.Object
JsonValueBase
JsonObject
Inherited Members
JsonValueBase.DataType
JsonValueBase.Parse(String)
Assembly: Alachisoft.NCache.Runtime.dll
Syntax
[Serializable]
public sealed class JsonObject : JsonValueBase, IJsonObject, IEnumerable<KeyValuePair<string, JsonValueBase>>, IEnumerable

Constructors

JsonObject()

The default constructor of class JsonObject.

Declaration
public JsonObject()

JsonObject(String)

An Overloaded constructor that populates attributes by parsing given JSONObject string.

Declaration
public JsonObject(string json)
Parameters
Type Name Description
System.String json

String representation of JSONObject.

JsonObject(String, String)

Overloaded constructor which populates attributes by parsing given JSONObject string and Type.

Declaration
public JsonObject(string json, string type)
Parameters
Type Name Description
System.String json

String representation of JSONObject.

System.String type

Type of the JSONObject.

Properties

Count

Number of attributes in object.

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32

Number of attributes.

Implements
IJsonObject.Count

InMemorySize

In memory size of the JSONObject.

Declaration
protected override int InMemorySize { get; }
Property Value
Type Description
System.Int32

In memory size of the JSONObject.

Overrides
JsonValueBase.InMemorySize

Item[String]

Iterates over attributes in JSONObject.

Declaration
public JsonValueBase this[string attributeName] { get; set; }
Parameters
Type Name Description
System.String attributeName

Name of the attribute.

Property Value
Type Description
JsonValueBase

An abstract class which acts as the base class for all JSON based types in NCache.

Implements
IJsonObject.Item[String]

Size

Size of the JSONObject.

Declaration
protected override int Size { get; }
Property Value
Type Description
System.Int32

Size of the JSONObject.

Overrides
JsonValueBase.Size

Type

Type of the Json object.

Declaration
public string Type { get; set; }
Property Value
Type Description
System.String

Type of the Json object.

Value

Returns instance of this object.

Declaration
public override object Value { get; }
Property Value
Type Description
System.Object

An instance of this object.

Overrides
JsonValueBase.Value

Methods

AddAttribute(String, JsonValue)

Adds an attribute in the object.

Declaration
public void AddAttribute(string attributeName, JsonValue attributeValue)
Parameters
Type Name Description
System.String attributeName

Name of the attribute.

JsonValue attributeValue

JSONValue as the attribute value.

Implements
IJsonObject.AddAttribute(String, JsonValue)

AddAttribute(String, JsonValueBase)

Adds an attribute in the object.

Declaration
public void AddAttribute(string attributeName, JsonValueBase attributeValue)
Parameters
Type Name Description
System.String attributeName

Name of the attribute.

JsonValueBase attributeValue

JsonValueBase as the attribute value.

Implements
IJsonObject.AddAttribute(String, JsonValueBase)

Clear()

Removes all attributes from JSONObject.

Declaration
public void Clear()
Implements
IJsonObject.Clear()

ContainsAttribute(String)

Checks if the attribute exits.

Declaration
public bool ContainsAttribute(string attributeName)
Parameters
Type Name Description
System.String attributeName

Name of the attribute.

Returns
Type Description
System.Boolean

True, if attribute exists.

Implements
IJsonObject.ContainsAttribute(String)

Equals(Object)

Checks if an object is equal to the existing instance of JSONObject.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj

An object to be compared.

Returns
Type Description
System.Boolean

Boolean value true or false.

Overrides
System.Object.Equals(System.Object)

GetAttributeNames()

Retruns collection of all the attribute names.

Declaration
public ICollection<string> GetAttributeNames()
Returns
Type Description
System.Collections.Generic.ICollection<System.String>

Collection of all the attribute names.

Implements
IJsonObject.GetAttributeNames()

GetAttributeValue(String)

Gets attribute value identified by the attribute name.

Declaration
public JsonValueBase GetAttributeValue(string attributeName)
Parameters
Type Name Description
System.String attributeName

Name of the attribute.

Returns
Type Description
JsonValueBase

Null, if doesn't exist.

Implements
IJsonObject.GetAttributeValue(String)

GetEnumerator()

Returns an enumerator that iterates through JSONObject attributes.

Declaration
public IEnumerator<KeyValuePair<string, JsonValueBase>> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<System.String, JsonValueBase>>

An enumerator that iterates through JSONObject attributes.

RemoveAttribute(String)

Removes attribute from object on the basis of attribute name provided.

Declaration
public bool RemoveAttribute(string attributeName)
Parameters
Type Name Description
System.String attributeName

Name of the attribute.

Returns
Type Description
System.Boolean

True, if exists and removed succcessfully.

Implements
IJsonObject.RemoveAttribute(String)

ToString()

Returns JSONObject in string representation.

Declaration
public override string ToString()
Returns
Type Description
System.String

JSONObject in string representation.

Overrides
System.Object.ToString()

Contact Us

PHONE

+1 (214) 764-6933   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • NCache Enterprise
  • NCache Community
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Download
Pricing
Try Playground

Deployments
  • Cloud (SaaS & Software)
  • On-Premises
  • Kubernetes
  • Docker
Technical Use Cases
  • ASP.NET Sessions
  • ASP.NET Core Sessions
  • Pub/Sub Messaging
  • Real-Time ASP.NET SignalR
  • Internet of Things (IoT)
  • NoSQL Database
  • Stream Processing
  • Microservices
Resources
  • Magazine Articles
  • Third-Party Articles
  • Articles
  • Videos
  • Whitepapers
  • Shows
  • Talks
  • Blogs
  • Docs
Customer Case Studies
  • Testimonials
  • Customers
Support
  • Schedule a Demo
  • Forum (Google Groups)
  • Tips
Company
  • Leadership
  • Partners
  • News
  • Events
  • Careers
Contact Us

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Contact Us
  •  
  • Sitemap
  •  
  • Terms of Use
  •  
  • Privacy Policy
© Copyright Alachisoft 2002 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top