/// Deserializes a single data value data - asserts on null value /// /// @param data /// The json data /// @param key /// The json key for the value to deserialize /// /// @return Deserialized object from the json dictionary /// public static object GetValueOrAssert(this Dictionary <string, object> data, string key) { object dataValue = JsonWrapper.GetValue(data, key); Debug.AssertFormat(dataValue != null, "Failed, {0} does not correspond to a value", key); return(dataValue); }
/// Deserializes a single data value data /// /// @param data /// The json data /// @param key /// The json key for the value to deserialize /// /// @return Deserialized object from the json dictionary /// or a default value if the deserialisation yields a null value /// public static object GetValueOrDefault(this Dictionary <string, object> data, string key, object defaultValue) { object dataValue = JsonWrapper.GetValue(data, key); if (dataValue == null) { return(defaultValue); } else { return(dataValue); } }