/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { GetLexiconResponse response = new GetLexiconResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Lexicon", targetDepth)) { var unmarshaller = LexiconUnmarshaller.Instance; response.Lexicon = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("LexiconAttributes", targetDepth)) { var unmarshaller = LexiconAttributesUnmarshaller.Instance; response.LexiconAttributes = unmarshaller.Unmarshall(context); continue; } } return(response); }
public static void GetLexicon() { String LEXICON_NAME = "SampleLexicon"; AmazonPollyClient client = new AmazonPollyClient(); GetLexiconRequest getLexiconRequest = new GetLexiconRequest() { Name = LEXICON_NAME }; try { GetLexiconResponse getLexiconResponse = client.GetLexicon(getLexiconRequest); Console.WriteLine("Lexicon:\n Name: {0}\nContent: {1}", getLexiconResponse.Lexicon.Name, getLexiconResponse.Lexicon.Content); } catch (Exception e) { Console.WriteLine("Exception caught: " + e.Message); } }