Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class Newtonsoft.​Json.​Linq.​JRaw
Assembly: Newtonsoft.Json
Inheritance: object → JToken → JValue → JRaw
Implemented Interfaces
- IJEnumerable`1 (Inherits: System.​Collections.​Generic.​IEnumerable<​JToken>System.​Collections.​IEnumerable) Implemented by: JToken
- IJsonLineInfo Implemented by: JToken
- System.​Dynamic.​IDynamicMetaObjectProvider Implemented by: JToken
- System.​IEquatable`1 Implemented by: JValue
- System.​IFormattable Implemented by: JValue
- System.​IComparable Implemented by: JValue
- System.​IComparable`1 Implemented by: JValue
Represents a raw JSON string.
Properties
public
bool
HasValues
Gets a value indicating whether this token has child tokens.
public
JTokenType
Type
Gets the node type for this <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
public
object
Value
Gets or sets the underlying token value.
public
JContainer
Parent
Gets or sets the parent.
public
JToken
Root
Gets the root <see cref="T:Newtonsoft.Json.Linq.JToken" /> of this <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
public
JToken
Next
Gets the next sibling token of this node.
public
JToken
Previous
Gets the previous sibling token of this node.
public
string
Path
Gets the path of the JSON token.
public
JToken
Item
public
JToken
First
Get the first child token of this token.
public
JToken
Last
Get the last child token of this token.
Methods
public static
System.​Threading.​Tasks.​Task<​JRaw>
CreateAsync​(JsonReader reader,
System.​Threading.​CancellationToken cancellationToken = null)
Asynchronously creates an instance of <see cref="T:Newtonsoft.Json.Linq.JRaw" /> with the content of the reader's current token.
Returns A <see cref="T:System.Threading.Tasks.Task`1" /> representing the asynchronous creation. The <see cref="P:System.Threading.Tasks.Task`1.Result" />
property returns an instance of <see cref="T:Newtonsoft.Json.Linq.JRaw" /> with the content of the reader's current token.
reader
The reader.
cancellationToken
The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
public static
JRaw
Create​(JsonReader reader)
Creates an instance of <see cref="T:Newtonsoft.Json.Linq.JRaw" /> with the content of the reader's current token.
Returns An instance of <see cref="T:Newtonsoft.Json.Linq.JRaw" /> with the content of the reader's current token.
reader
The reader.
WriteToAsync​(JsonWriter writer,
System.​Threading.​CancellationToken cancellationToken,
JsonConverter[] converters)
Inherited from JValue
Writes this token to a <see cref="T:Newtonsoft.Json.JsonWriter" /> asynchronously.
Returns A <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous write operation.
writer
A <see cref="T:Newtonsoft.Json.JsonWriter" /> into which this method will write.
cancellationToken
The token to monitor for cancellation requests.
converters
A collection of <see cref="T:Newtonsoft.Json.JsonConverter" /> which will be used when writing the token.
public
void
WriteTo​(JsonWriter writer,
JsonConverter[] converters)
Inherited from JValue
Writes this token to a <see cref="T:Newtonsoft.Json.JsonWriter" /> .
writer
A <see cref="T:Newtonsoft.Json.JsonWriter" /> into which this method will write.
converters
A collection of <see cref="T:Newtonsoft.Json.JsonConverter" /> s which will be used when writing the token.
public
bool
Equals​(JValue other)
Inherited from JValue
Indicates whether the current object is equal to another object of the same type.
Returns <c>true</c> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <c>false</c> .
other
An object to compare with this object.
public
bool
Equals​(object obj)
Inherited from JValue
Determines whether the specified <see cref="T:System.Object" /> is equal to the current <see cref="T:System.Object" /> .
Returns <c>true</c> if the specified <see cref="T:System.Object" /> is equal to the current <see cref="T:System.Object" /> ; otherwise, <c>false</c> .
obj
The <see cref="T:System.Object" /> to compare with the current <see cref="T:System.Object" /> .
public
int
GetHashCode​()
Inherited from JValue
Serves as a hash function for a particular type.
Returns A hash code for the current <see cref="T:System.Object" /> .
public
string
ToString​()
Inherited from JValue
Returns a <see cref="T:System.String" /> that represents this instance.
Returns A <see cref="T:System.String" /> that represents this instance.
public
string
ToString​(string format)
Inherited from JValue
Returns a <see cref="T:System.String" /> that represents this instance.
Returns A <see cref="T:System.String" /> that represents this instance.
format
The format.
public
string
ToString​(System.​IFormatProvider formatProvider)
Inherited from JValue
Returns a <see cref="T:System.String" /> that represents this instance.
Returns A <see cref="T:System.String" /> that represents this instance.
formatProvider
The format provider.
public
string
ToString​(string format,
System.​IFormatProvider formatProvider)
Inherited from JValue
Returns a <see cref="T:System.String" /> that represents this instance.
Returns A <see cref="T:System.String" /> that represents this instance.
format
The format.
formatProvider
The format provider.
GetMetaObject​(System.​Linq.​Expressions.​Expression parameter)
Inherited from JValue
Returns the <see cref="T:System.Dynamic.DynamicMetaObject" /> responsible for binding operations performed on this object.
Returns The <see cref="T:System.Dynamic.DynamicMetaObject" /> to bind this object.
parameter
The expression tree representation of the runtime value.
public
int
CompareTo​(JValue obj)
Inherited from JValue
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Returns A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings:
Value
Meaning
Less than zero
This instance is less than <paramref name="obj" /> .
Zero
This instance is equal to <paramref name="obj" /> .
Greater than zero
This instance is greater than <paramref name="obj" /> .
obj
An object to compare with this instance.
WriteToAsync​(JsonWriter writer,
JsonConverter[] converters)
Inherited from JToken
Writes this token to a <see cref="T:Newtonsoft.Json.JsonWriter" /> asynchronously.
Returns A <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous write operation.
writer
A <see cref="T:Newtonsoft.Json.JsonWriter" /> into which this method will write.
converters
A collection of <see cref="T:Newtonsoft.Json.JsonConverter" /> which will be used when writing the token.
public
void
AddAfterSelf​(object content)
Inherited from JToken
Adds the specified content immediately after this token.
content
A content object that contains simple content or a collection of content objects to be added after this token.
public
void
AddBeforeSelf​(object content)
Inherited from JToken
Adds the specified content immediately before this token.
content
A content object that contains simple content or a collection of content objects to be added before this token.
public
System.​Collections.​Generic.​IEnumerable<​JToken>
Ancestors​()
Inherited from JToken
Returns a collection of the ancestor tokens of this token.
Returns A collection of the ancestor tokens of this token.
public
System.​Collections.​Generic.​IEnumerable<​JToken>
AncestorsAndSelf​()
Inherited from JToken
Returns a collection of tokens that contain this token, and the ancestors of this token.
Returns A collection of tokens that contain this token, and the ancestors of this token.
public
System.​Collections.​Generic.​IEnumerable<​JToken>
AfterSelf​()
Inherited from JToken
Returns a collection of the sibling tokens after this token, in document order.
Returns A collection of the sibling tokens after this tokens, in document order.
public
System.​Collections.​Generic.​IEnumerable<​JToken>
BeforeSelf​()
Inherited from JToken
Returns a collection of the sibling tokens before this token, in document order.
Returns A collection of the sibling tokens before this token, in document order.
public
T
Value​(object key)
Inherited from JToken
Gets the <see cref="T:Newtonsoft.Json.Linq.JToken" /> with the specified key converted to the specified type.
Returns The converted token value.
key
The token key.
public
JEnumerable<​JToken>
Children​()
Inherited from JToken
Returns a collection of the child tokens of this token, in document order.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:Newtonsoft.Json.Linq.JToken" /> containing the child tokens of this <see cref="T:Newtonsoft.Json.Linq.JToken" /> , in document order.
public
JEnumerable<​T>
Children​()
Inherited from JToken
Returns a collection of the child tokens of this token, in document order, filtered by the specified type.
Returns A <see cref="T:Newtonsoft.Json.Linq.JEnumerable`1" /> containing the child tokens of this <see cref="T:Newtonsoft.Json.Linq.JToken" /> , in document order.
public
System.​Collections.​Generic.​IEnumerable<​T>
Values​()
Inherited from JToken
Returns a collection of the child values of this token, in document order.
Returns A <see cref="T:System.Collections.Generic.IEnumerable`1" /> containing the child values of this <see cref="T:Newtonsoft.Json.Linq.JToken" /> , in document order.
public
void
Replace​(JToken value)
Inherited from JToken
Replaces this token with the specified token.
value
The value.
public
string
ToString​(Formatting formatting,
JsonConverter[] converters)
Inherited from JToken
Returns the JSON for this token using the given formatting and converters.
Returns The JSON for this token using the given formatting and converters.
formatting
Indicates how the output should be formatted.
converters
A collection of <see cref="T:Newtonsoft.Json.JsonConverter" /> s which will be used when writing the token.
public
JsonReader
CreateReader​()
Inherited from JToken
Creates a <see cref="T:Newtonsoft.Json.JsonReader" /> for this token.
Returns A <see cref="T:Newtonsoft.Json.JsonReader" /> that can be used to read this token and its descendants.
public
T
ToObject​()
Inherited from JToken
Creates an instance of the specified .NET type from the <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
Returns The new object created from the JSON value.
public
object
ToObject​(System.​Type objectType)
Inherited from JToken
Creates an instance of the specified .NET type from the <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
Returns The new object created from the JSON value.
objectType
The object type that the token will be deserialized to.
public
T
ToObject​(JsonSerializer jsonSerializer)
Inherited from JToken
Creates an instance of the specified .NET type from the <see cref="T:Newtonsoft.Json.Linq.JToken" /> using the specified <see cref="T:Newtonsoft.Json.JsonSerializer" /> .
Returns The new object created from the JSON value.
jsonSerializer
The <see cref="T:Newtonsoft.Json.JsonSerializer" /> that will be used when creating the object.
public
object
ToObject​(System.​Type objectType,
JsonSerializer jsonSerializer)
Inherited from JToken
Creates an instance of the specified .NET type from the <see cref="T:Newtonsoft.Json.Linq.JToken" /> using the specified <see cref="T:Newtonsoft.Json.JsonSerializer" /> .
Returns The new object created from the JSON value.
objectType
The object type that the token will be deserialized to.
jsonSerializer
The <see cref="T:Newtonsoft.Json.JsonSerializer" /> that will be used when creating the object.
public
JToken
SelectToken​(string path)
Inherited from JToken
Selects a <see cref="T:Newtonsoft.Json.Linq.JToken" /> using a JPath expression. Selects the token that matches the object path.
Returns A <see cref="T:Newtonsoft.Json.Linq.JToken" /> , or <c>null</c> .
path
A <see cref="T:System.String" /> that contains a JPath expression.
public
JToken
SelectToken​(string path,
bool errorWhenNoMatch)
Inherited from JToken
Selects a <see cref="T:Newtonsoft.Json.Linq.JToken" /> using a JPath expression. Selects the token that matches the object path.
Returns A <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
path
A <see cref="T:System.String" /> that contains a JPath expression.
errorWhenNoMatch
A flag to indicate whether an error should be thrown if no tokens are found when evaluating part of the expression.
public
System.​Collections.​Generic.​IEnumerable<​JToken>
SelectTokens​(string path)
Inherited from JToken
Selects a collection of elements using a JPath expression.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:Newtonsoft.Json.Linq.JToken" /> that contains the selected elements.
path
A <see cref="T:System.String" /> that contains a JPath expression.
public
System.​Collections.​Generic.​IEnumerable<​JToken>
SelectTokens​(string path,
bool errorWhenNoMatch)
Inherited from JToken
Selects a collection of elements using a JPath expression.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:Newtonsoft.Json.Linq.JToken" /> that contains the selected elements.
path
A <see cref="T:System.String" /> that contains a JPath expression.
errorWhenNoMatch
A flag to indicate whether an error should be thrown if no tokens are found when evaluating part of the expression.
public
JToken
DeepClone​()
Inherited from JToken
Creates a new instance of the <see cref="T:Newtonsoft.Json.Linq.JToken" /> . All child tokens are recursively cloned.
Returns A new instance of the <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
public
void
AddAnnotation​(object annotation)
Inherited from JToken
Adds an object to the annotation list of this <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
annotation
The annotation to add.
public
T
Annotation​()
Inherited from JToken
Get the first annotation object of the specified type from this <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
Returns The first annotation object that matches the specified type, or <c>null</c> if no annotation is of the specified type.
public
object
Annotation​(System.​Type type)
Inherited from JToken
Gets the first annotation object of the specified type from this <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
Returns The first annotation object that matches the specified type, or <c>null</c> if no annotation is of the specified type.
type
The <see cref="P:Newtonsoft.Json.Linq.JToken.Type" /> of the annotation to retrieve.
public
System.​Collections.​Generic.​IEnumerable<​T>
Annotations​()
Inherited from JToken
Gets a collection of annotations of the specified type for this <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the annotations for this <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
public
System.​Collections.​Generic.​IEnumerable<​object>
Annotations​(System.​Type type)
Inherited from JToken
Gets a collection of annotations of the specified type for this <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Object" /> that contains the annotations that match the specified type for this <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
type
The <see cref="P:Newtonsoft.Json.Linq.JToken.Type" /> of the annotations to retrieve.
public
void
RemoveAnnotations​()
Inherited from JToken
Removes the annotations of the specified type from this <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
public
void
RemoveAnnotations​(System.​Type type)
Inherited from JToken
Removes the annotations of the specified type from this <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
type
The <see cref="P:Newtonsoft.Json.Linq.JToken.Type" /> of annotations to remove.
protected
void
Finalize​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object