Example #1
0
        public List <ResponseFlows> getValuesResponse(object response)
        {
            ResponseFlows        responseFlows = new ResponseFlows();
            List <ResponseFlows> responses     = new List <ResponseFlows>();

            for (int i = 0; i < ((object[])response).Count(); i++)
            {
                Dictionary <string, object> idResp = (Dictionary <string, object>)(((object[])response))[i];
                for (int j = 0; j < idResp.Count(); j++)
                {
                    if ((idResp.ToArray()[j]).Key == "responseFlow")
                    {
                        Dictionary <string, object> idFlows = (Dictionary <string, object>)(idResp.ToArray()[j]).Value;

                        for (int k = 0; k < idFlows.Count; k++)
                        {
                            if (idFlows.ToArray()[k].Key == "categories")
                            {
                                /// if (idFlows.ToArray()[k].Key == "id")
                                ///    responseFlows.idFlows = idFlows.ToArray()[k].Value.ToString();

                                object categoriesID = idFlows.ToArray()[k].Value;

                                Dictionary <string, object> a = (Dictionary <string, object>)((object[])categoriesID)[0];
                                for (int l = 0; l < a.Count; l++)
                                {
                                    if (a.ToArray()[l].Key == "id")
                                    {
                                        responseFlows.idFlows = a.ToArray()[l].Value.ToString();
                                        break;
                                    }
                                }

                                break;
                            }
                        }
                    }

                    if ((idResp.ToArray()[j]).Key == "id")
                    {
                        responseFlows.idResponse = (idResp.ToArray()[j]).Value.ToString();
                    }
                }
                responses.Add(responseFlows);
            }//for

            return(responses);
        }
Example #2
0
        public ResponseFlows handlerResponseFlow(string response)
        {
            ResponseFlows responseFlows = new ResponseFlows();

            object resp = JsonConvert.DeserializeObject(response);
            JEnumerable <JToken> jTk = ((JObject)resp).Children();

            foreach (var jtok in jTk)
            {
                if (jtok.Path == "id")
                {
                    responseFlows.idResponse = jtok.First().ToString();
                    break;
                }
            }

            return(responseFlows);
        }