Public classes


Scripts/

   JArray
   JBoolean
   JNull
   JNumber
   JSON
   JString
   JValue

Scripts/Attributes/

      ExcludeFromJSONSerializeAttribute
      IncludeToJSONSerializeAttribute

Scripts/Exceptions/

      DeserializeException
      JArgumentException
      JArgumentNullException
      JArrayIndexOutOfRangeException
      JNumberFormatException
      JNumberOverflowException
      JSONKeyAlreadyExistsException
      JSONKeyNotFoundException
      JValueNullException
      JValueTypeException
      ParseException
      ProtectedException
      SerializeException
      UnknownObjectTypeException

Scripts/Settings/

      CreateStringSettings
      DeserializeSettings
      ParseStringSettings
      SerializeSettings


Introduction page

JNumber
Derived from JValue


Class to store number value in JSON format. Once JNumber instance is created, its value can't be changed.

There is no limit how long or big numbers can be, but trying to read too big number for example as long will cause exception. Oversized numbers can be still read out and handled as strings.


Constructors

public JNumber (string numberAsString)Creates new JSON number value from string.
public JNumber (int numberAsInt)Creates new JSON number value from c# int value.
public JNumber (long numberAsLong)Creates new JSON number value from c# long value.
public JNumber (float numberAsFloat)Creates new JSON number value from c# float value.
public JNumber (double numberAsDouble)Creates new JSON number value from c# double value.
public JNumber (decimal numberAsDecimal)Creates new JSON number value from c# decimal value.

Methods

public byte AsByte ()Gets value of this number object as byte.
public decimal AsDecimal ()Gets value of this number object as decimal.
public double AsDouble ()Gets value of this number object as double.
public float AsFloat ()Gets value of this number object as float.
public int AsInt ()Gets value of this number object as int.
public long AsLong ()Gets value of this number object as long.
public object AsObject ()Gets value of this number as object.
public sbyte AsSByte ()Gets value of this number object as signed byte.
public short AsShort ()Gets value of this number object as short.
public string AsString ()Gets value of this number as string.
public uint AsUInt ()Gets value of this number object as unsigned int.
public ulong AsULong ()Gets value of this number object as unsigned long.
public ushort AsUShort ()Gets value of this number object as unsigned short.
public override bool Equals (object anotherObject)Test if another object equals to this object.
public override string ToString ()Returns compact information of this JNumber object as string, for debug purposes.

Constructors

public JNumber (string numberAsString)

Creates new JSON number value from string. There is no limits in number size as long as it follows json number format.

ParametersnumberAsStringValue for this JNumber object in string format.

ExceptionsJArgumentExceptionIf parameter string is not valid number.


public JNumber (int numberAsInt)

Creates new JSON number value from c# int value.

ParametersnumberAsIntValue for this JNumber object.


public JNumber (long numberAsLong)

Creates new JSON number value from c# long value.

ParametersnumberAsLongValue for this JNumber object.


public JNumber (float numberAsFloat)

Creates new JSON number value from c# float value.

ParametersnumberAsFloatValue for this JNumber object.

ExceptionsJArgumentExceptionIf parameter is NaN or Infinity.


public JNumber (double numberAsDouble)

Creates new JSON number value from c# double value.

ParametersnumberAsDoubleValue for this JNumber object.

ExceptionsJArgumentExceptionIf parameter is NaN or Infinity.


public JNumber (decimal numberAsDecimal)

Creates new JSON number value from c# decimal value.

ParametersnumberAsDecimalValue for this JNumber object.


Methods

public byte AsByte ()

Gets value of this number object as byte. This will throw exception if number is floating point number or outside byte range.

ReturnsValue as byte.

ExceptionsJNumberFormatExceptionIf number stored to this JNumber is floating point number.
 JNumberOverflowExceptionIf number stored to this JNumber doesn't fit in byte.


public decimal AsDecimal ()

Gets value of this number object as decimal. This will throw exception if number is outside decimal range or number contains E/e notation.

ReturnsValue as decimal.

ExceptionsJNumberFormatExceptionIf number stored to this JNumber uses E/e notation (like 1.234567e89)
 JNumberOverflowExceptionIf number stored to this JNumber doesn't fit in decimal.


public double AsDouble ()

Gets value of this number object as double. This will throw exception if number is outside double range.

ReturnsValue as double.

ExceptionsJNumberOverflowExceptionIf number stored to this JNumber doesn't fit in double.


public float AsFloat ()

Gets value of this number object as float. This will throw exception if number is outside float range.

ReturnsValue as float.

ExceptionsJNumberOverflowExceptionIf number stored to this JNumber doesn't fit in float.


public int AsInt ()

Gets value of this number object as int. This will throw exception if number is floating point number or outside int range.

ReturnsValue as int.

ExceptionsJNumberFormatExceptionIf number stored to this JNumber is floating point number.
 JNumberOverflowExceptionIf number stored to this JNumber doesn't fit in int.


public long AsLong ()

Gets value of this number object as long. This will throw exception if number is floating point number or outside long range.

ReturnsValue as long.

ExceptionsJNumberFormatExceptionIf number stored to this JNumber is floating point number.
 JNumberOverflowExceptionIf number stored to this JNumber doesn't fit in long.


public object AsObject ()

Gets value of this number as object. First fitting value of these are returned: int, long, float, double

ReturnsValue as object, that may be one of the 4 basic number objects.

ExceptionsJNumberOverflowExceptionIf number stored to this JNumber doesn't fit in double.


public sbyte AsSByte ()

Gets value of this number object as signed byte. This will throw exception if number is floating point number or outside sbyte range.

ReturnsValue as sbyte.

ExceptionsJNumberFormatExceptionIf number stored to this JNumber is floating point number.
 JNumberOverflowExceptionIf number stored to this JNumber doesn't fit in sbyte.


public short AsShort ()

Gets value of this number object as short. This will throw exception if number is floating point number or outside short range.

ReturnsValue as short.

ExceptionsJNumberFormatExceptionIf number stored to this JNumber is floating point number.
 JNumberOverflowExceptionIf number stored to this JNumber doesn't fit in short.


public string AsString ()

Gets value of this number as string.

ReturnsValue as string.


public uint AsUInt ()

Gets value of this number object as unsigned int. This will throw exception if number is floating point number or outside uint range.

ReturnsValue as uint.

ExceptionsJNumberFormatExceptionIf number stored to this JNumber is floating point number.
 JNumberOverflowExceptionIf number stored to this JNumber doesn't fit in uint.


public ulong AsULong ()

Gets value of this number object as unsigned long. This will throw exception if number is floating point number or outside ulong range.

ReturnsValue as ulong.

ExceptionsJNumberFormatExceptionIf number stored to this JNumber is floating point number.
 JNumberOverflowExceptionIf number stored to this JNumber doesn't fit in ulong.


public ushort AsUShort ()

Gets value of this number object as unsigned short. This will throw exception if number is floating point number or outside ushort range.

ReturnsValue as ushort.

ExceptionsJNumberFormatExceptionIf number stored to this JNumber is floating point number.
 JNumberOverflowExceptionIf number stored to this JNumber doesn't fit in ushort.


public override bool Equals (object anotherObject)

Test if another object equals to this object. Always returns false if parameter object is null or it is not instance of JNumber. Two JNumber objects are equal if both contains value which string representation is exactly equal. For example JNumber that contains "1" is not equal to JNumber that contains "1.0"

ParametersanotherObjectAnother object that is compared to this one.

ReturnsTrue if objects are equal, false otherwise.


public override string ToString ()

Returns compact information of this JNumber object as string, for debug purposes.

ReturnsSingle string with information of this JNumber object.