JsonPatchDocument.ParseValue Method
Definition
Namespace: Corvus.Text.Json.Patch
Assembly: Corvus.Text.Json.dll
Overloads
| Method | Description |
|---|---|
| ParseValue(ReadOnlySpan<byte>, JsonDocumentOptions) | Parses one JSON value (including objects or arrays) from the provided span. |
| ParseValue(ReadOnlySpan<char>, JsonDocumentOptions) | Parses one JSON value (including objects or arrays) from the provided span. |
| ParseValue(string, JsonDocumentOptions) | Parses one JSON value (including objects or arrays) from the provided text. |
| ParseValue(ref Utf8JsonReader) | Parses one JSON value (including objects or arrays) from the provided reader. |
ParseValue(ReadOnlySpan<byte>, JsonDocumentOptions)
Parses one JSON value (including objects or arrays) from the provided span.
public static JsonPatchDocument ParseValue(ReadOnlySpan<byte> utf8Json, JsonDocumentOptions options)
Parameters
| Name | Type | Description |
|---|---|---|
utf8Json |
ReadOnlySpan<byte> |
The span to read. |
options |
JsonDocumentOptions |
The JsonDocumentOptions for reading. (optional) |
Returns
An instance representing the value (and nested values) read from the span.
Exceptions
| Exception | Description |
|---|---|
JsonException |
A value could not be read from the span. |
Remarks
This method makes a copy of the data the reader acted on, so there is no caller requirement to maintain data integrity beyond the return of this method.
Applies To
| Product | Versions |
|---|---|
| .NET | 9, 10 |
| .NET Standard | 2.0, 2.1 |
ParseValue(ReadOnlySpan<char>, JsonDocumentOptions)
Parses one JSON value (including objects or arrays) from the provided span.
public static JsonPatchDocument ParseValue(ReadOnlySpan<char> json, JsonDocumentOptions options)
Parameters
| Name | Type | Description |
|---|---|---|
json |
ReadOnlySpan<char> |
The span to read. |
options |
JsonDocumentOptions |
The JsonDocumentOptions for reading. (optional) |
Returns
An instance representing the value (and nested values) read from the span.
Exceptions
| Exception | Description |
|---|---|
JsonException |
A value could not be read from the span. |
Remarks
This method makes a copy of the data the reader acted on, so there is no caller requirement to maintain data integrity beyond the return of this method.
Applies To
| Product | Versions |
|---|---|
| .NET | 9, 10 |
| .NET Standard | 2.0, 2.1 |
ParseValue(string, JsonDocumentOptions)
Parses one JSON value (including objects or arrays) from the provided text.
public static JsonPatchDocument ParseValue(string json, JsonDocumentOptions options)
Parameters
| Name | Type | Description |
|---|---|---|
json |
string |
The text to read. |
options |
JsonDocumentOptions |
The JsonDocumentOptions for reading. (optional) |
Returns
An instance representing the value (and nested values) read from the text.
Exceptions
| Exception | Description |
|---|---|
JsonException |
A value could not be read from the text. |
Remarks
This method makes a copy of the data the reader acted on, so there is no caller requirement to maintain data integrity beyond the return of this method.
Applies To
| Product | Versions |
|---|---|
| .NET | 9, 10 |
| .NET Standard | 2.0, 2.1 |
ParseValue(ref Utf8JsonReader)
Parses one JSON value (including objects or arrays) from the provided reader.
public static JsonPatchDocument ParseValue(ref Utf8JsonReader reader)
Parameters
| Name | Type | Description |
|---|---|---|
reader |
ref Utf8JsonReader |
The reader to read. |
Returns
An instance representing the value (and nested values) read from the reader.
Exceptions
| Exception | Description |
|---|---|
ArgumentException |
reader is using unsupported options. |
ArgumentException |
The current reader token does not start or represent a value. |
JsonException |
A value could not be read from the reader. |
Remarks
If the TokenType property of reader is PropertyName or None, the reader will be advanced by one call to Read to determine the start of the value. Upon completion of this method, reader will be positioned at the final token in the JSON value. If an exception is thrown, the reader is reset to the state it was in when the method was called. This method makes a copy of the data the reader acted on, so there is no caller requirement to maintain data integrity beyond the return of this method.
Applies To
| Product | Versions |
|---|---|
| .NET | 9, 10 |
| .NET Standard | 2.0, 2.1 |
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests.
Open an issue