public RecentCaseCommunications Unmarshall(JsonUnmarshallerContext context) { if (context.CurrentTokenType == JsonToken.Null) { return(null); } RecentCaseCommunications recentCaseCommunications = new RecentCaseCommunications(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("communications", targetDepth)) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) { recentCaseCommunications.Communications = null; continue; } recentCaseCommunications.Communications = new List <Communication>(); CommunicationUnmarshaller unmarshaller = CommunicationUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } recentCaseCommunications.Communications.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("nextToken", targetDepth)) { context.Read(); recentCaseCommunications.NextToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return(recentCaseCommunications); } } return(recentCaseCommunications); }
public DescribeCommunicationsResult Unmarshall(JsonUnmarshallerContext context) { DescribeCommunicationsResult describeCommunicationsResult = new DescribeCommunicationsResult(); describeCommunicationsResult.Communications = 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("Communications", targetDepth)) { describeCommunicationsResult.Communications = new List <Communication>(); CommunicationUnmarshaller unmarshaller = CommunicationUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { describeCommunicationsResult.Communications.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } if (context.TestExpression("NextToken", targetDepth)) { describeCommunicationsResult.NextToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(describeCommunicationsResult); } } return(describeCommunicationsResult); }
private static void UnmarshallResult(JsonUnmarshallerContext context, DescribeCommunicationsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("communications", targetDepth)) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) { response.Communications = null; continue; } response.Communications = new List <Communication>(); CommunicationUnmarshaller unmarshaller = CommunicationUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.Communications.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("nextToken", targetDepth)) { context.Read(); response.NextToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return; } } return; }