public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribeTapesResponse response = new DescribeTapesResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Tapes", targetDepth)) { var unmarshaller = new ListUnmarshaller <Tape, TapeUnmarshaller>( TapeUnmarshaller.GetInstance()); response.Tapes = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Marker", targetDepth)) { response.Marker = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } return(response); }
private static void UnmarshallResult(JsonUnmarshallerContext context, DescribeTapesResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("Tapes", targetDepth)) { context.Read(); response.Tapes = new List <Tape>(); TapeUnmarshaller unmarshaller = TapeUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.Tapes.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("Marker", targetDepth)) { context.Read(); response.Marker = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return; } } return; }