﻿@model dynamic
@using Umbraco.Web.Templates
@{
    var embedValue = string.Empty;
    try {
        embedValue = Model.value.preview;
    } catch(Exception ex) {
        embedValue = Model.value;
    }
}

<div class="video-wrapper">
	@Html.Raw(embedValue)
</div>

﻿@model dynamic
@using Umbraco.Web.Templates
@{
    string embedValue = Convert.ToString(Model.value);
    embedValue = embedValue.DetectIsJson() ? Model.value.preview : Model.value;
}

<div class="video-wrapper">
	@Html.Raw(embedValue)
</div>

Use DetectIsJson string extension as opposed to a horrible try/catch
Use DetectIsJson string extension as opposed to a horrible try/catch
