C# json-c中的数字格式

C# json-c中的数字格式,c#,json,double,truncated,json-c,C#,Json,Double,Truncated,Json C,我想要添加到json对象中的数字远低于零(p.e.1.34e-14)。为此,我使用以下代码: smallnumber=1.34e-14; struct json_object *pointj=json_object_new_object(); json_object_object_add(pointj,"par", json_object_new_double(smallnumber); cout << "\nThe json object created: " <<

我想要添加到json对象中的数字远低于零(p.e.1.34e-14)。为此,我使用以下代码:

smallnumber=1.34e-14;
struct json_object *pointj=json_object_new_object();
json_object_object_add(pointj,"par", json_object_new_double(smallnumber);
cout << "\nThe json object created: " <<  json_object_to_json_string(pointj);
smallnumber=1.34e-14;
struct json_object*pointj=json_object_new_object();
json_object_object_add(pointj,“par”,json_object_new_double(smallnumber);

cout这个问题可能有更优雅的解决方案,但我是这样解决的:

double smallnumber=1.34e-14;
stringstream tmp;
tmp << smallnumber;
struct json_object *pointj=json_object_new_object();
json_object_object_add(pointj,"par", json_object_new_string(tmp.str().c_str());
double smallnumber=1.34e-14;
stringstream tmp;
tmp