private static void UnmarshallResult(JsonUnmarshallerContext context, ListVaultsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("VaultList", targetDepth)) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) { response.VaultList = null; continue; } response.VaultList = new List <DescribeVaultOutput>(); DescribeVaultOutputUnmarshaller unmarshaller = DescribeVaultOutputUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.VaultList.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; }
public ListVaultsResult Unmarshall(JsonUnmarshallerContext context) { ListVaultsResult listVaultsResult = new ListVaultsResult(); listVaultsResult.VaultList = null; int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if ((context.IsKey) && (context.CurrentDepth == targetDepth)) { context.Read(); context.Read(); if (context.TestExpression("VaultList", targetDepth)) { listVaultsResult.VaultList = new List <DescribeVaultOutput>(); DescribeVaultOutputUnmarshaller unmarshaller = DescribeVaultOutputUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { listVaultsResult.VaultList.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } if (context.TestExpression("Marker", targetDepth)) { listVaultsResult.Marker = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(listVaultsResult); } } return(listVaultsResult); }