isJsonDecodable property

bool get isJsonDecodable

Check if string is json decodable or not

Implementation

bool get isJsonDecodable {
  if (isEmptyOrNull) return false;
  try {
    jsonDecode(this!) as Map<String, dynamic>;
    // jsonDecode(this!);
    // ignore: unused_catch_clause
  } on FormatException catch (e) {
    return false;
  }
  return true;
}