isJson property

bool get isJson

Returns true if string is a valid JSON string

Implementation

bool get isJson {
  if (this == null) {
    return false;
  }
  try {
    jsonDecode(this!);
    return true;
  } catch (e) {
    return false;
  }
}