shrinkJson function

Uint8List shrinkJson(
  1. Map<String, dynamic> data
)

Compresses a JSON object to a compact binary representation.

This function first encodes the JSON object to a string using jsonEncode, which minifies the JSON by removing unnecessary whitespace. The minified JSON string is then compressed using shrinkText, which applies UTF-8 encoding followed by zlib compression.

Returns a Uint8List containing the compressed JSON data.

Implementation

Uint8List shrinkJson(Map<String, dynamic> data) {
  final minified = jsonEncode(data); // Minified JSON string
  return shrinkText(minified); // Compress the string
}