isJSON function

bool isJSON(
  1. String input
)

check if string input is json (stringyfied)

Implementation

bool isJSON(String input) {
  try {
    jsonDecode(input);
  } catch (e) {
    return false;
  }
  return true;
}