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); }
public static bool TryDeserializeObject(string json, out object obj) { bool result = true; if (json != null) { int num = 0; obj = PlayFabSimpleJson.ParseValue(json, ref num, ref result); } else { obj = null; } return(result); }
private static JsonArray ParseArray(string json, ref int index, ref bool success) { JsonArray jsonArray = new JsonArray(); 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.SQUARED_CLOSE) { PlayFabSimpleJson.NextToken(json, ref index); break; } object item = PlayFabSimpleJson.ParseValue(json, ref index, ref success); if (!success) { return(null); } jsonArray.Add(item); } } return(jsonArray); }