internal Variable GetFromJson(bool top_level) { char look = SkipWhite(true); if (look == '[') { VarDeque q = new VarDeque(); SkipChar('['); while (true) { look = SkipWhite(true); if (look == ']') { break; } if (q.Count() != 0) { SkipChar(','); } q.Push(GetFromJson(false)); } SkipWhite(true); SkipChar(']'); return(setting.MakeArray(q, new VarDeque())); } else if (look == '{') { VarHash q = new VarHash(); int ct = 0; SkipChar('{'); while (true) { look = SkipWhite(true); if (look == '}') { break; } if (ct != 0) { SkipCharWS(','); } ct++; string key = GetJsonString(); SkipWhite(true); SkipChar(':'); q[key] = GetFromJson(false); } SkipWhite(true); SkipChar('}'); return(BoxRW <VarHash>(q, setting.HashMO)); } else if (top_level) { Err("Top-level scalar found"); return(null); } else if (look == '"') { return(BoxRW <string>(GetJsonString(), setting.StrMO)); } else if (look == 'n') { SkipToken("null"); return(Kernel.NewMuScalar(setting.AnyP)); } else if (look == 't') { SkipToken("true"); return(Kernel.NewMuScalar(setting.TrueV.Fetch())); } else if (look == 'f') { SkipToken("false"); return(Kernel.NewMuScalar(setting.FalseV.Fetch())); } else { double d; string tx = GetJsonNumber(); if (!Utils.S2NB(tx, out d)) { Err("Unparsable number " + tx); } return(BoxRW <double>(d, setting.NumMO)); } }