Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Serialization of anonymous paid cart DTO to JSON text.
var paidCartAnon = new
{
_state = "paid",
paidItems = new object[] {
new {
id = "1bcd",
title = "gizmo"
},
new {
id = "3cdf",
title = "widget",
description = "A very useful item"
}
},
payment = new {
mount = 123.5,
currency = "USD"
},
timestamp = "2020-04-11T10:11:33.514+02:00"
};
var paidCartAnonJsonText = JsonConvert.SerializeObject(paidCartAnon);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment