/// <summary>
/// Deserializes the specified <paramref name="json"/> string into an instance of <see cref="GridDataModel"/>.
/// </summary>
/// <param name="json">The JSON string to be deserialized.</param>
/// <param name="propertyTypeAlias">The alias of the property the Grid model is representing.</param>
public static GridDataModel Deserialize(string json, string propertyTypeAlias)
{
// Validate the JSON
if (json == null || !json.StartsWith("{") || !json.EndsWith("}"))
{
return(null);
}
// Deserialize the JSON
JObject obj = JObject.Parse(json);
// Parse basic properties
GridDataModel model = new GridDataModel(obj)
{
Raw = json,
Name = obj.GetString("name"),
PropertyAlias = propertyTypeAlias
};
// Parse the sections
model.Sections = obj.GetArray("sections", x => GridSection.Parse(model, x)) ?? new GridSection[0];
// Return the model
return(model);
}