isJsonLike function

bool isJsonLike(
  1. String text
)

Implementation

bool isJsonLike(String text) {
  final trimmedText = text.trim();

  if (trimmedText.isEmpty) return false;

  if ((trimmedText.startsWith('{') && trimmedText.endsWith('}')) ||
      (trimmedText.startsWith('[') && trimmedText.endsWith(']'))) {
    return true;
  }

  return false;
}