-
Notifications
You must be signed in to change notification settings - Fork 22
JsonValue
LightJson.JsonValue
is a struct in the LightJson library, designed to represent a JSON value.
It encapsulates various JSON data types such as null, boolean, number, string, object, and array.
-
public JsonValue(bool? value)
Initializes a new instance of theJsonValue
struct, representing a boolean value. -
public JsonValue(double? value)
Initializes a new instance of theJsonValue
struct, representing a number value. -
public JsonValue(string value)
Initializes a new instance of theJsonValue
struct, representing a string value. -
public JsonValue(JsonObject value)
Initializes a new instance of theJsonValue
struct, representing aJsonObject
value. -
public JsonValue(JsonArray value)
Initializes a new instance of theJsonValue
struct, representing aJsonArray
value.
-
public JsonValueType Type { get; }
Gets the type of thisJsonValue
. -
public bool IsNull { get; }
Gets a value indicating whether thisJsonValue
isnull
. -
public bool IsBoolean { get; }
Gets a value indicating whether thisJsonValue
represents a boolean value. -
public bool IsInteger { get; }
Gets a value indicating whether thisJsonValue
represents an integer value. -
public bool IsNumber { get; }
Gets a value indicating whether thisJsonValue
represents a number. -
public bool IsString { get; }
Gets a value indicating whether thisJsonValue
represents a string. -
public bool IsJsonObject { get; }
Gets a value indicating whether thisJsonValue
is aJsonObject
. -
public bool IsJsonArray { get; }
Gets a value indicating whether thisJsonValue
is aJsonArray
. -
public bool IsDateTime { get; }
Gets a value indicating whether thisJsonValue
represents aDateTime
.
-
public JsonValue Parse(string text)
Returns aJsonValue
by parsing the given string.
-
== Operator
Returns a value indicating whether the two givenJsonValue
instances are equal. -
!= Operator
Returns a value indicating whether the two givenJsonValue
instances are unequal.
The JsonValue
struct provides implicit conversion operators for various data types such as bool
, int
, double
, string
, JsonObject
, JsonArray
, and DateTime
.
JsonValue
stores DateTime
values as strings using ISO 8601 format since JSON does not define a DateTime
type.
The struct provides methods and operators for easy conversion between JSON data types and .NET data types.
JsonValue is lightweight and designed for efficient handling of JSON data.