Beispiel #1
0
        internal static IEnumerable <KeyValuePair <string, string> > Traverse(JObject jObject)
        {
            var visitor = new JsonVisitor();
            IDictionary <string, string> data = new SortedDictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            foreach (KeyValuePair <string, string> primitive in visitor.VisitJObject(jObject))
            {
                if (data.ContainsKey(primitive.Key))
                {
                    throw new FormatException($"Key {primitive.Key} is duplicated in json");
                }

                data.Add(primitive);
                yield return(primitive);
            }

            //return data;
        }