コード例 #1
0
        public static ResultForRoot FromJson(JObject json)
        {
            var result = new ResultForRoot(
                RootPosition.FromJson(json["position"].Value <JObject>()));

            foreach (Select select in SelectHelper.Values)
            {
                var selectStr = select.Stringify();
                if (json.ContainsKey(selectStr))
                {
                    result.ResultsBySelect.Add(select, SelectResult.FromJson(json[selectStr].Value <JObject>()));
                }
            }

            if (json.ContainsKey("retractions"))
            {
                foreach ((string key, var value) in json["retractions"].Value <JObject>())
                {
                    var entries = SegregatedEntries.FromJson(value.Value <JObject>());
                    result.Retractions.Add(key, entries);
                }
            }

            return(result);
        }
コード例 #2
0
        public static QueryResponse FromJson(JObject json)
        {
            var result = new QueryResponse();

            foreach (var entry in json["results"])
            {
                result.Results.Add(ResultForRoot.FromJson(entry.Value <JObject>()));
            }

            return(result);
        }