Exemple #1
0
 public static bool asBool(this JSONObject json, string name, Func <bool> orDefault)
 {
     return(JSONConverter.Get(json, name, (JSONObject f) => f.b, orDefault, JSONObject.Type.BOOL));
 }
Exemple #2
0
 public static JSONObject asJSONObject(this JSONObject json, string name, JSONObject.Type expectedType = JSONObject.Type.OBJECT)
 {
     return(JSONConverter.Get(json, name, (JSONObject f) => f, () => new JSONObject(expectedType), expectedType));
 }
Exemple #3
0
 public static T asCustom <T>(this JSONObject json, string name, Func <JSONObject, T> convert, Func <T> orDefault)
 {
     return(JSONConverter.Get(json, name, (JSONObject f) => convert(f), orDefault));
 }
Exemple #4
0
 public static BigDouble asBigDouble(this JSONObject json, string name, Func <BigDouble> orDefault)
 {
     return(JSONConverter.Get(json, name, (JSONObject f) => BigDouble.Parse(f.str), orDefault, JSONObject.Type.STRING));
 }
Exemple #5
0
 public static string asString(this JSONObject json, string name, Func <string> orDefault)
 {
     return(JSONConverter.Get(json, name, (JSONObject f) => f.str, orDefault, JSONObject.Type.STRING));
 }
Exemple #6
0
 public static long asLong(this JSONObject json, string name, Func <long> orDefault)
 {
     return(JSONConverter.Get(json, name, (JSONObject f) => f.i, orDefault, JSONObject.Type.NUMBER));
 }
Exemple #7
0
 public static int asInt(this JSONObject json, string name, Func <int> orDefault)
 {
     return(JSONConverter.Get(json, name, (JSONObject f) => (int)f.i, orDefault, JSONObject.Type.NUMBER));
 }
Exemple #8
0
 public static float asFloat(this JSONObject json, string name, Func <float> orDefault)
 {
     return(JSONConverter.Get(json, name, (JSONObject f) => f.n, orDefault, JSONObject.Type.NUMBER));
 }