Add a parameter in JSON.ToString( ), which converts variables in OC to string in html with full precision, to specify format
struct TestObj{
float ff;
double dd;
string str;
};
void test_json()
{
TestObj obj;
obj.ff = 1.234567890123456789 ;
obj.dd = 1.234567890123456789 ;
obj.str = "3.1415926" ;
string strJSON1, strJSON2;
OCJSONToString params;
params.szFloatFmt = ".2" ;
JSON.ToString(obj, strJSON1);
JSON.ToString(obj, strJSON2, ¶ms);
}
|