17

Deserialization of a paid cart. · GitHub

 3 years ago
source link: https://gist.github.com/einarwh/8d884bb611e29006be0ea810926225f7
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Deserialization of a paid cart. · GitHub

Instantly share code, notes, and snippets.

Deserialization of a paid cart.

var paidCartJsonString = @"{ ""_state"": ""paid"", ""paidItems"": [ { ""id"": ""1bcd"", ""title"": ""gizmo"" }, { ""id"" : ""3cdf"", ""title"": ""widget"", ""description"": ""A very useful item"" } ], ""payment"": { ""amount"": 123.5, ""currency"": ""USD"" }, ""timestamp"": ""2020-04-11T10:11:33.514+02:00"" }";

var paidCartDtoFromText = JsonConvert.DeserializeObject<PaidCart>(paidCartJsonString);

var firstItemTitle = paidCartDtoFromText.PaidItems[0].Title; var currency = paidCartDtoFromText.Payment.Currency;


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK