Skip to main content
Post Closed as "Duplicate" by Salah Akbari, dbc c#

We want to serialize an object to JSON with Newton.JSON, but this Object use an enum and is then converted in the underlying int (see 'Datatype' in JSON below). How can ve proceed to get the "enum string" representation?

{ "Timestamp": 1538568112852, "Metrics": [ { "Name": "bdSeq", "Timestamp": 1538568112852, "Datatype": 4, "IsNull": false, "LongValue": 0 } ], "Seq": 18446744073709551615 }

{ "Timestamp": 1538568112852, "Metrics": [{ "Name": "bdSeq", "Timestamp": 1538568112852, "Datatype": 4, "IsNull": false, "LongValue": 0 }], "Seq": 18446744073709551615 } 

We want to serialize an object to JSON with Newton.JSON, but this Object use an enum and is then converted in the underlying int (see 'Datatype' in JSON below). How can ve proceed to get the "enum string" representation?

{ "Timestamp": 1538568112852, "Metrics": [ { "Name": "bdSeq", "Timestamp": 1538568112852, "Datatype": 4, "IsNull": false, "LongValue": 0 } ], "Seq": 18446744073709551615 }

We want to serialize an object to JSON with Newton.JSON, but this Object use an enum and is then converted in the underlying int (see 'Datatype' in JSON below). How can ve proceed to get the "enum string" representation?

{ "Timestamp": 1538568112852, "Metrics": [{ "Name": "bdSeq", "Timestamp": 1538568112852, "Datatype": 4, "IsNull": false, "LongValue": 0 }], "Seq": 18446744073709551615 } 
Source Link

Newton.JSON Serialize number to Enum item

We want to serialize an object to JSON with Newton.JSON, but this Object use an enum and is then converted in the underlying int (see 'Datatype' in JSON below). How can ve proceed to get the "enum string" representation?

{ "Timestamp": 1538568112852, "Metrics": [ { "Name": "bdSeq", "Timestamp": 1538568112852, "Datatype": 4, "IsNull": false, "LongValue": 0 } ], "Seq": 18446744073709551615 }