toJson method

T toJson()

Implementation

T toJson() {
  if (this is MapEntry) {
    return _encodeJson(this) as T;
  }
  if (this is List<T>) {
    return (this as List<T>).map((T e) => e.toJson()).toList(growable: false)
        as T;
  }
  if (this is List<dynamic>) {
    return (this as List<dynamic>)
        .cast<Map<String, dynamic>>()
        .map((Map<String, dynamic> e) => e.toJson())
        .toList(growable: false) as T;
  }
  if (this is List<Map<String, dynamic>> || this is Map<String, dynamic>) {
    return jsonDecode(toHuman());
  }
  return this;
}