datasetjson.netrowstate

Serializing a DataSet/DataTable with properties in json.net


I'm looking a solution to serialize dataset to json, but I need to get the rowstate in json.

Does json.net serialize / deserialize properties of the dataset / datatable, like rowstate? I can only find examples with row value.

Thanks.


Solution

  • No, the DataTableConverter that ships with Json.Net does not serialize the RowState. If you really need this value in the JSON, it should be possible to create a custom JsonConverter to output it. However, it will not be possible to deserialize the RowState back to its original value due to the fact that it is a read-only property. (In fact, this value is calculated from a variety of internal state variables.)