Class JsonValue

Namespace
Subsembly.Json
Assembly
Subsembly.Json.dll
public class JsonValue : ICloneable
Inheritance
JsonValue
Implements
Derived
Inherited Members

Constructors

JsonValue(bool)

public JsonValue(bool f)

Parameters

f bool

JsonValue(decimal)

public JsonValue(decimal n)

Parameters

n decimal

JsonValue(double)

public JsonValue(double n)

Parameters

n double

JsonValue(int)

public JsonValue(int n)

Parameters

n int

JsonValue(long)

public JsonValue(long n)

Parameters

n long

JsonValue(float)

public JsonValue(float n)

Parameters

n float

JsonValue(string)

public JsonValue(string s)

Parameters

s string

Fields

Null

public static readonly JsonValue Null

Field Value

JsonValue

Undefined

public static readonly JsonValue Undefined

Field Value

JsonValue

Properties

this[int]

Access to the indexed elements of a JSON array.

public JsonValue this[int nIndex] { get; set; }

Parameters

nIndex int

Property Value

JsonValue

Remarks

Access an index that is outside of the range of the array will return null, and NOT a JsonValue of type Undefined.

Exceptions

JsonTypeException

Thrown is this is not an Array.

ArgumentOutOfRangeException

An attempt was made to set a value with an index outside of the range of the array. It is not possible to grow an array just by setting values outside of the current range of values.

this[string]

Access to the named properties of a JSON object.

public JsonValue this[string sName] { get; set; }

Parameters

sName string

Name of property, or path to a nested property seperated with dots.

Property Value

JsonValue

Remarks

Setting a property to null will delete that property, and not insert a new JsonValue of type Null. If you want an empty property you have to explicitly pass an appropriate JsonValue.

Getting a property that is not defined will return null and NOT a JsonValue of type Undefined.

Exceptions

ArgumentNullException

The index sName was null.

JsonTypeException

Thrown if this is not an Object.

JsonType

public JsonType JsonType { get; }

Property Value

JsonType

Value

The primitive value.

public object Value { get; }

Property Value

object

ValueAsBoolean

public bool ValueAsBoolean { get; }

Property Value

bool

ValueAsNumber

public double ValueAsNumber { get; }

Property Value

double

ValueAsString

Returns the value as a string.

public string ValueAsString { get; }

Property Value

string

Remarks

If this value is not a String, then this method attempts to convert it to a string, first. Conversion is done using the usual JavaScript conversion rules, including conversion of type Undefined to string "undefined" and type Null to string "null".

Methods

Clone()

public object Clone()

Returns

object

Load(Stream)

public static JsonValue Load(Stream aStream)

Parameters

aStream Stream

Returns

JsonValue

Load(TextReader)

public static JsonValue Load(TextReader aTextReader)

Parameters

aTextReader TextReader

Returns

JsonValue

Load(string)

public static JsonValue Load(string sFileName)

Parameters

sFileName string

Returns

JsonValue

Parse(byte[])

public static JsonValue Parse(byte[] vbJson)

Parameters

vbJson byte[]

Returns

JsonValue

Parse(string)

public static JsonValue Parse(string sJson)

Parameters

sJson string

Returns

JsonValue

Save(Stream)

public void Save(Stream aStream)

Parameters

aStream Stream

Save(TextWriter)

public void Save(TextWriter aTextWriter)

Parameters

aTextWriter TextWriter

Save(string)

public void Save(string sFileName)

Parameters

sFileName string

ToByteArray()

public byte[] ToByteArray()

Returns

byte[]

ToString()

Converts this value into its JSON string representation.

public override string ToString()

Returns

string

Operators

implicit operator bool(JsonValue)

public static implicit operator bool(JsonValue aValue)

Parameters

aValue JsonValue

Returns

bool

implicit operator decimal(JsonValue)

public static implicit operator decimal(JsonValue aValue)

Parameters

aValue JsonValue

Returns

decimal

implicit operator double(JsonValue)

public static implicit operator double(JsonValue aValue)

Parameters

aValue JsonValue

Returns

double

implicit operator int(JsonValue)

public static implicit operator int(JsonValue aValue)

Parameters

aValue JsonValue

Returns

int

implicit operator long(JsonValue)

public static implicit operator long(JsonValue aValue)

Parameters

aValue JsonValue

Returns

long

implicit operator float(JsonValue)

public static implicit operator float(JsonValue aValue)

Parameters

aValue JsonValue

Returns

float

implicit operator string(JsonValue)

public static implicit operator string(JsonValue aValue)

Parameters

aValue JsonValue

Returns

string

implicit operator JsonValue(bool)

public static implicit operator JsonValue(bool f)

Parameters

f bool

Returns

JsonValue

implicit operator JsonValue(decimal)

public static implicit operator JsonValue(decimal n)

Parameters

n decimal

Returns

JsonValue

implicit operator JsonValue(double)

public static implicit operator JsonValue(double n)

Parameters

n double

Returns

JsonValue

implicit operator JsonValue(int)

public static implicit operator JsonValue(int n)

Parameters

n int

Returns

JsonValue

implicit operator JsonValue(long)

public static implicit operator JsonValue(long n)

Parameters

n long

Returns

JsonValue

implicit operator JsonValue(float)

public static implicit operator JsonValue(float n)

Parameters

n float

Returns

JsonValue

implicit operator JsonValue(string)

public static implicit operator JsonValue(string s)

Parameters

s string

Returns

JsonValue