formatSingleQuote function

String formatSingleQuote(
  1. String jsonData
)

Implementation

String formatSingleQuote(String jsonData) {
  return jsonData
      .replaceAll('\'', '\\\'')
      .replaceAllMapped(RegExp('([^\\\\])"'), (match) => '${match[1]}\'')
      .replaceAll('\\"', '"');
}