isJson static method

bool isJson(
  1. String? s
)

Implementation

static bool isJson(String? s) {
  if(s==null || s.isEmpty) return false;
  try{
    jsonDecode(s);
    return true;
  } catch(e) {
    return false;
  }
}