Hi All,
As I am converting the below JSON from dataset, in the backend oracle it is number datatype.
so due this in the json I am getting like decimal value. How to avoid this
that not to get like decimal value.
{
"max_no": 899.0,
"total": 10200.0,
"no": 123456789.0
}
Class file
- public class root
- {
- public decimal max_no { get; set; }
- public double total { get; set; }
- public decimal no { get; set; }
- }
C# code
- var JsonList = ds.Tables[0].AsEnumerable().Select(dataRow => new root()
- {
- max_no =dataRow.Field<decimal>("max_no"),
- total = dataRow.Field<double>("total"),
- no = dataRow.Field<decimal>("no")
- }).ToList();
- return Request.CreateResponse(HttpStatusCode.OK, JsonList);
how to get the JSON as below
{
"max_no": 899,
"total": 10200,
"no": 123456789
}