convertToJson static method
Serialises data to a JSON string.
Throws JsonSerializationException when a value cannot be serialised, rather than returning the string "null" for the caller to cache.
Implementation
static String convertToJson(dynamic data) => json.encode(_encode(data));