예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rootNode"></param>
        /// <returns></returns>
        public Dictionary <string, object> ParseToDictionary(KeyValueNode rootNode)
        {
            var listKeyValueNodeParser = new ListKeyValueNodeParser();
            var jsonAsDictionary       = listKeyValueNodeParser.GetDictionary(rootNode.Value as ListKeyValueNode);

            return(jsonAsDictionary);
        }
예제 #2
0
        /// <summary>
        /// Parse a dictionary to a KeyValueNode
        /// </summary>
        /// <param name="jsonAsDictionary"></param>
        /// <returns></returns>
        public KeyValueNode ParseToKeyValueNode(Dictionary <string, object> jsonAsDictionary)
        {
            KeyValueNode rootnode = new KeyValueNode()
            {
                Key = "Root",
            };

            var listKeyValueNodeParser = new ListKeyValueNodeParser();
            var listKeyValueNode       = listKeyValueNodeParser.GetKeyValueNodes(jsonAsDictionary, 0);

            rootnode.Value = listKeyValueNode;

            return(rootnode);
        }