private static object ParseValue(string json, ref int index, ref bool success) { switch (PlayFabSimpleJson.LookAhead(json, index)) { case PlayFabSimpleJson.TokenType.CURLY_OPEN: return(PlayFabSimpleJson.ParseObject(json, ref index, ref success)); case PlayFabSimpleJson.TokenType.SQUARED_OPEN: return(PlayFabSimpleJson.ParseArray(json, ref index, ref success)); case PlayFabSimpleJson.TokenType.STRING: return(PlayFabSimpleJson.ParseString(json, ref index, ref success)); case PlayFabSimpleJson.TokenType.NUMBER: return(PlayFabSimpleJson.ParseNumber(json, ref index, ref success)); case PlayFabSimpleJson.TokenType.TRUE: PlayFabSimpleJson.NextToken(json, ref index); return(true); case PlayFabSimpleJson.TokenType.FALSE: PlayFabSimpleJson.NextToken(json, ref index); return(false); case PlayFabSimpleJson.TokenType.NULL: PlayFabSimpleJson.NextToken(json, ref index); return(null); } success = false; return(null); }
private static IDictionary <string, object> ParseObject(string json, ref int index, ref bool success) { IDictionary <string, object> dictionary = new JsonObject(); PlayFabSimpleJson.NextToken(json, ref index); bool flag = false; while (!flag) { PlayFabSimpleJson.TokenType tokenType = PlayFabSimpleJson.LookAhead(json, index); if (tokenType == PlayFabSimpleJson.TokenType.NONE) { success = false; return(null); } if (tokenType == PlayFabSimpleJson.TokenType.COMMA) { PlayFabSimpleJson.NextToken(json, ref index); } else { if (tokenType == PlayFabSimpleJson.TokenType.CURLY_CLOSE) { PlayFabSimpleJson.NextToken(json, ref index); return(dictionary); } string key = PlayFabSimpleJson.ParseString(json, ref index, ref success); if (!success) { success = false; return(null); } tokenType = PlayFabSimpleJson.NextToken(json, ref index); if (tokenType != PlayFabSimpleJson.TokenType.COLON) { success = false; return(null); } object value = PlayFabSimpleJson.ParseValue(json, ref index, ref success); if (!success) { success = false; return(null); } dictionary[key] = value; } } return(dictionary); }