nice_json library

Classes

JsonOptions

Functions

encodeList(List object, JsonOptions options) String
Encodes a list as JSON.
encodeMap(Map object, JsonOptions options) String
Encodes a map as JSON. This should probably be a Map<String, dynamic>, but this is not a constraint that is checked. Consider using niceJson() instead.
encodeMapEntry(MapEntry object, JsonOptions options) String
Encodes a single map entry as JSON.
encodeNumber(num object) String
Encodes a number as JSON. Just converts it to a string.
encodeObject(Object? object, JsonOptions options) String
Encodes object as JSON, given options. This is the base level function, but consider using niceJson() instead.
encodeString(String object) String
Encodes a string as JSON. Just wraps double quotes around it.
niceJson(Map<String, dynamic> data, {String indent = ' ', int maxContentLength = 40, int maxLineLength = 80, List<String> alwaysExpandKeys = const [], int minDepth = 1}) String
Encodes data as nicely formatted human-readable JSON. indent is the indent character added to the start of each line. By default, this is a single space, but other good options are two spaces or a tab ('\t'). maxContentLength is the maximum length of a single entry. maxLineLength is the maximum length of a single line, including key and indent. Any keys in alwaysExpandKeys will have their values expanded, regardless of line length.