By using RemObjects and Oxygene over .NET, declaring a specific object type, I want to serialize it to JSON and maintain at least two decimal places after serialization.
Example:
<code>MyType = private class
public
valueD: System.Nullable<Double>;
end;
</code>
<code>MyType = private class
public
valueD: System.Nullable<Double>;
end;
</code>
MyType = private class
public
valueD: System.Nullable<Double>;
end;
<code>var
data: MyType;
s: string;
begin
data := new MyType;
data.valueD := 1.9;
s := new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(data);
// Result:
// s = {"valueD": 1.9}
// I want this:
// s = {"valueD": 1.90}
end;
</code>
<code>var
data: MyType;
s: string;
begin
data := new MyType;
data.valueD := 1.9;
s := new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(data);
// Result:
// s = {"valueD": 1.9}
// I want this:
// s = {"valueD": 1.90}
end;
</code>
var
data: MyType;
s: string;
begin
data := new MyType;
data.valueD := 1.9;
s := new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(data);
// Result:
// s = {"valueD": 1.9}
// I want this:
// s = {"valueD": 1.90}
end;
How can I get result like “1.90”?