Returns true if str is valid JSON.
true
str
bool isJson(String str) { try { jsonDecode(str); return true; } catch (_) { return false; } }