public JSON_Object SelectObj(string selector) { if (!selector.Contains(".") && !selector.Contains("[")) { return(searchByName(selector)); } JSON_Object obj = this; char[] cs = selector.ToCharArray(); int cursor = 0; for (int i = 0; i < cs.Length; i++) { if (cs[i] == '[') { if (cs[i - 1] != ']') { obj = obj.searchByName(CsSubString(selector, cursor, i)); cursor = i; } int t = findEnd(CsSubString(selector, cursor, selector.Length), '[', ']'); string cut = deDeco(CsSubString(selector, cursor + 1, cursor + t)); int ib; try { ib = int.Parse(cut); obj = obj.objArr[ib]; } catch (Exception e) { Console.Error.Write(e); obj = obj.objArr[int.Parse(select(cut))]; } i = cursor + t; if (i + 1 < cs.Length && cs[i + 1] == '.') { i++; } cursor = i + 1; } else if (cs[i] == '.' || i >= selector.Length - 1) { string newSelec = CsSubString(selector, cursor, i + 1); if (newSelec.EndsWith(".")) { newSelec = CsSubString(newSelec, 0, newSelec.Length - 1); } obj = obj.searchByName(newSelec); cursor = i + 1; } } return(obj); }