Show / Hide Table of Contents

Struct NewtonsoftAdapter

Struct NewtonsoftAdapter implements IJson by wrapping a Newtonsoft.Json.Linq.JToken.

Implements
IJson
Namespace: Jtd.Jtd
Assembly: Jtd.Jtd.dll
Syntax
public struct NewtonsoftAdapter : IJson
Remarks

You can construct an instance of Newtonsoft's JToken in multiple ways; JToken is Newtonsoft.Json's representation of arbitrary JSON data. However you construct these instances, it is strongly recommended that you set the DateParseHandling setting to DateParseHandling.None.

If you do not disable date parsing, then Newtonsoft.Json will lose the original format of the inputted data if it recognizes the data as a date, and will erroneously report data as valid when it is not.

If you are constructing instances of Newtonsoft.Json.Linq.JToken using Newtonsoft.Json.JsonConvert.DeserializeObject(System.String), then set Newtonsoft.Json.JsonSerializerSettings.DateParseHandling to None. If you're instead using Newtonsoft.Json.Linq.JToken.ReadFrom(Newtonsoft.Json.JsonReader), then set Newtonsoft.Json.JsonTextReader.DateParseHandling to None.

Constructors

| Improve this Doc View Source

NewtonsoftAdapter(JToken)

Constructs a NewtonsoftAdapter around a JToken.

Declaration
public NewtonsoftAdapter(JToken token)
Parameters
Type Name Description
Newtonsoft.Json.Linq.JToken token

the token to wrap

Methods

| Improve this Doc View Source

AsArray()

Declaration
public IList<IJson> AsArray()
Returns
Type Description
IList<IJson>
| Improve this Doc View Source

AsBoolean()

Declaration
public bool AsBoolean()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

AsNumber()

Declaration
public double AsNumber()
Returns
Type Description
System.Double
| Improve this Doc View Source

AsObject()

Declaration
public IDictionary<string, IJson> AsObject()
Returns
Type Description
IDictionary<System.String, IJson>
| Improve this Doc View Source

AsString()

Declaration
public string AsString()
Returns
Type Description
System.String
| Improve this Doc View Source

IsArray()

Declaration
public bool IsArray()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsBoolean()

Declaration
public bool IsBoolean()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsNull()

Declaration
public bool IsNull()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsNumber()

Declaration
public bool IsNumber()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsObject()

Declaration
public bool IsObject()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsString()

Declaration
public bool IsString()
Returns
Type Description
System.Boolean

Implements

IJson

See Also

Validate(Schema, IJson)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX