genByJson method

String genByJson(
  1. dynamic input
)

Encodes input without changing JSON-native scalar types.

Strings are truncated only when compact and maxWidth enable it. Values that JSON cannot represent use explicit tagged structures.

Implementation

String genByJson(dynamic input) {
  final normalized = _normalizeLogValue(input, HashSet<Object>.identity());
  return prettyJson
      ? const JsonEncoder.withIndent('  ').convert(normalized)
      : jsonEncode(normalized);
}