Chancer
07/26/2023, 12:18 PMJemayn
07/26/2023, 12:59 PMD_Inventor
07/26/2023, 1:32 PMBlockValue
first. You get a semi-stronglytyped model that you can edit slightly easier than just the raw jsonChancer
07/26/2023, 2:26 PMChancer
07/26/2023, 2:50 PMChancer
07/26/2023, 3:14 PMcsharp
var contentNode = ContentService.GetById(node.Id);
var jsonValue = contentNode.GetValue("sectionPicker").ToString();
BlockValue blockValue = JsonConvert.DeserializeObject<BlockValue>(jsonValue);
foreach(var settingObj in blockValue.SettingsData)
{
foreach (var settingColumnProperty in settingObj.RawPropertyValues)
{
if(settingColumnProperty.Key == "backgroundColor")
{
var colorObj = settingColumnProperty.Value.ToString();
var color = JsonConvert.DeserializeObject<ColorPickerValueConverter.PickedColor>(colorObj);
<pre>
@color.Label
@color.Color
</pre>
}
}
}
This is a simple "output it into a pre tag on a page" - Ofcourse, dont normally hit the content service on a view for prod 😛