public override double CreateType(IJsonStruct jsonStruct) { if (jsonStruct == null) { return(default(double)); } else if (jsonStruct is IJsonFloat jf) { return(jf.Float); } throw new Exception($"Cannot convert {jsonStruct.GetType().FullName} to a double."); }
public override int CreateType(IJsonStruct jsonStruct) { if (jsonStruct == null) { return(default(int)); } else if (jsonStruct is IJsonInteger js) { return((int)js.Integer); } throw new Exception($"Cannot convert {jsonStruct.GetType().FullName} to a string."); }
public override bool CreateType(IJsonStruct jsonStruct) { if (jsonStruct == null) { return(default(bool)); } else if (jsonStruct is IJsonBoolean jb) { return(jb.Boolean); } throw new Exception($"Cannot convert {jsonStruct.GetType().FullName} to a boolean."); }
public override string CreateType(IJsonStruct jsonStruct) { if (jsonStruct == null) { return(null); } else if (jsonStruct is IJsonString js) { return(js.String); } throw new Exception($"Cannot convert {jsonStruct.GetType().FullName} to a string."); }