Table of Contents

Class JsonUnmarshallerContext

Namespace
Amazon.Runtime.Internal.Transform
Assembly
AWSSDK.Core.dll

Wraps a json string for unmarshalling.

Each Read() operation gets the next token. TestExpression() is used to match the current key-chain to an xpath expression. The general pattern looks like this:

JsonUnmarshallerContext context = new JsonUnmarshallerContext(jsonString);
while (context.Read())
{
    if (context.IsKey)
    {
        if (context.TestExpresion("path/to/element"))
        {
            myObject.stringMember = stringUnmarshaller.GetInstance().Unmarshall(context);
            continue;
        }
    }
}
public class JsonUnmarshallerContext : UnmarshallerContext, IDisposable
Inheritance
JsonUnmarshallerContext
Implements
Inherited Members

Constructors

JsonUnmarshallerContext(Stream, bool, IWebResponseData, bool)

Wrap the jsonstring for unmarshalling.

public JsonUnmarshallerContext(Stream responseStream, bool maintainResponseBody, IWebResponseData responseData, bool isException = false)

Parameters

responseStream Stream

Stream that contains the JSON for unmarshalling

maintainResponseBody bool

If set to true, maintains a copy of the complete response body constraint to log response size as the stream is being read.

responseData IWebResponseData

Response data coming back from the request

isException bool

If set to true, maintains a copy of the complete response body as the stream is being read.

JsonUnmarshallerContext(Stream, bool, IWebResponseData, bool, IRequestContext)

Wrap the jsonstring for unmarshalling.

public JsonUnmarshallerContext(Stream responseStream, bool maintainResponseBody, IWebResponseData responseData, bool isException, IRequestContext requestContext)

Parameters

responseStream Stream

Stream that contains the JSON for unmarshalling

maintainResponseBody bool

If set to true, maintains a copy of the complete response body constraint to log response size as the stream is being read.

responseData IWebResponseData

Response data coming back from the request

isException bool

If set to true, maintains a copy of the complete response body as the stream is being read.

requestContext IRequestContext

Context for the request that produced this response

Properties

CurrentDepth

Returns the element depth of the parser's current position in the json document being parsed.

public override int CurrentDepth { get; }

Property Value

int

CurrentPath

The current Json path that is being unmarshalled.

public override string CurrentPath { get; }

Property Value

string

CurrentTokenType

The type of the current token

public JsonToken CurrentTokenType { get; }

Property Value

JsonToken

IsEndElement

Is the current token the end of an object

public override bool IsEndElement { get; }

Property Value

bool

IsStartElement

Is the current token the start of an object

public override bool IsStartElement { get; }

Property Value

bool

IsStartOfDocument

Are we at the start of the json document.

public override bool IsStartOfDocument { get; }

Property Value

bool

Stream

Get the base stream of the jsonStream.

public Stream Stream { get; }

Property Value

Stream

Methods

Dispose(bool)

protected override void Dispose(bool disposing)

Parameters

disposing bool

Peek()

Peeks at the next (non-whitespace) character in the jsonStream.

public int Peek()

Returns

int

The next (non-whitespace) character in the jsonStream, or -1 if at the end.

Peek(JsonToken)

Peeks at the next token. This peek implementation reads the next token and makes the subsequent Read() return the same data. If Peek is called successively, it will return the same data. Only the first one calls Read(), subsequent calls will return the same data until a Read() call is made.

public bool Peek(JsonToken token)

Parameters

token JsonToken

Token to peek.

Returns

bool

Returns true if the peeked token matches given token.

Read()

Reads to the next token in the json document, and updates the context accordingly.

public override bool Read()

Returns

bool

True if a token was read, false if there are no more tokens to read.

ReadText()

Returns the text contents of the current token being parsed.

public override string ReadText()

Returns

string

The text contents of the current token being parsed.

ToJsonData()

public JsonData ToJsonData()

Returns

JsonData