Data Type
All data stored in BACKND are in a string format.
To allow each data type to be recognized, all pieces of data have their types as key values.
Classification | Data Type | Description |
---|---|---|
BOOL | bool | Includes the data in boolean format. |
N | numbers | Includes all number type data, such as int, float, and double. |
S | string | Includes all data in string format. |
L | list | Includes data in list format. |
M | map | Includes data in map and dictionary formats. |
NULL | null | Includes data that does not have a value. |
Identifying the data format of the JSON value to be returned
Method that returns the data format of Jsondata's key
public static string WhichDataTypeIsIt(BACKND.LitJson.JsonData data, string key)
{
if(data.Keys.Contains(key))
{
if(data[key].Keys.Contains("S")) // string
return "S";
else if(data[key].Keys.Contains("N")) // number
return "N";
else if(data[key].Keys.Contains("M")) // map
return "M";
else if(data[key].Keys.Contains("L")) // list
return "L";
else if(data[key].Keys.Contains("BOOL")) // boolean
return "BOOL";
else if(data[key].Keys.Contains("NULL")) // null
return "NULL";
else
return null;
}
else
{
return null;
}
}
Method that returns the data format of the nth value of JsonData in a list format
public static string WhichDataTypeIsIt(BACKND.LitJson.JsonData data, int n)
{
if(data.IsArray)
{
if(data[n].Keys.Contains("S")) // string
return "S";
else if(data[n].Keys.Contains("N")) // number
return "N";
else if(data[n].Keys.Contains("M")) // map
return "M";
else if(data[n].Keys.Contains("L")) // list
return "L";
else if(data[n].Keys.Contains("BOOL")) // boolean
return "BOOL";
else if(data[n].Keys.Contains("NULL")) // null
return "NULL";
else
return null;
}
else
{
return null;
}
}