isValidJSON property

bool get isValidJSON

Checks if this string is valid JSON

Returns true if the string is valid JSON, false otherwise

Example:

print('{"name":"John"}'.isValidJSON); // true
print('invalid json'.isValidJSON); // false

Implementation

bool get isValidJSON {
  return jsonValidate().isValid;
}