Ejemplo n.º 1
0
        private object Node2Item(object dic)
        {
            JsonObject js = new JsonObject();
            if (dic is IFreeDocument)
            {
                var res = (dic as IFreeDocument).DictSerialize();
                js.AddRange(res);
                var fre = dic as FreeDocument;
                if (fre != null)
                {
                    if (fre.Children != null)
                    {
                        JsonArray array = new JsonArray();
                        foreach (var child in fre.Children)
                        {
                            array.Add(Node2Item(child));
                        }
                        if (!js.HasMembers)
                            return array;
                        js.Add("Children", array);
                    }
                }
            }
            else
            {
                return dic;
            }

            return js;
        }