Example #1
0
        private string imm_get_json_path_array(YJSONArray jsonArray, string[] paths, int ofs)
        {
            int key = Convert.ToInt32(paths[ofs]);

            if (jsonArray.Length <= key)
            {
                return("");
            }

            YJSONContent obj = jsonArray.get(key);

            if (obj != null)
            {
                if (paths.Length == ofs + 1)
                {
                    return(obj.ToString());
                }

                if (obj is YJSONArray)
                {
                    return(imm_get_json_path_array(jsonArray.getYJSONArray(key), paths, ofs + 1));
                }
                else if (obj is YJSONObject)
                {
                    return(imm_get_json_path_struct(jsonArray.getYJSONObject(key), paths, ofs + 1));
                }
            }
            return("");
        }
        public override string ToString()
        {
            StringBuilder res = new StringBuilder();

            res.Append('{');
            string sep = "";

            foreach (string key in parsed.Keys.ToArray())
            {
                YJSONContent subContent = parsed[key];
                string       subres     = subContent.ToString();
                res.Append(sep);
                res.Append(key);
                res.Append("=>");
                res.Append(subres);
                sep = ",";
            }
            res.Append('}');
            return(res.ToString());
        }