Skip to content

Instantly share code, notes, and snippets.

@kgiszewski
Created June 19, 2018 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kgiszewski/2d90ac6e2c04d53bb993fa8dc97147a6 to your computer and use it in GitHub Desktop.
Save kgiszewski/2d90ac6e2c04d53bb993fa8dc97147a6 to your computer and use it in GitHub Desktop.
using Newtonsoft.Json;
namespace Models
{
public class NestedContentModel
{
//not sure if we need this
[JsonProperty("name")]
public string Name { get; set; }
//required for the doctype alias
[JsonProperty("ncContentTypeAlias")]
public string NcContentTypeAlias { get; set; }
//a textstring property from the doc type
[JsonProperty("value")]
public string Value { get; set; }
//do we need a key?
}
}
// then in a class
var ncModel = new List<NestedContentModel>
{
new NestedContentModel
{
Name = "Store Number",
Value = 1234
}
};
// then serialize and set it to a IContent
content.SetValue("someProprtyAlias", JsonConvert.SerializeObject(ncModel));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment