You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.
Pure Krome edited this page Feb 1, 2016
·
1 revision
Saving the data as Json
The object model includes some extra meta data about wether or not an piece of data has been modified or not. This is used when copying some source listing object to a destination object. Which fields to we include?
As such, it's nice (but not madatory) to save the data to a json file format and to exclude this data modified status. Basically, save all the data but exclude the DataModified property.
The trick is to use the ListingConverter which has been provided for you.
This is how you can do it using Newtonsoft.Json:
var jsonSettings = new JsonSerializerSettings
{
Converters = new JsonConverter[] { new ListingConverter() },
};
var json = JsonConvert.SerializeObject(listing, jsonSettings);
The custom converter is not required when de-serializing, because the source json (to deserialize) should not have any DataModified key/values in it 😄