Pretty print JSON stored as a String
or Json.Encode.Value
{ indent : Basics.Int
, columns : Basics.Int
}
Formating configuration.
indent
is the number of spaces in an indent.
columns
is the desired column width of the formatted string. The formatter
will try to fit it as best as possible to the column width, but can still
exceed this limit. The maximum column width of the formatted string is
unbounded.
prettyString : Config -> String -> Result String String
Formats a JSON string.
passes the string through Json.Decode.decodeString
and bubbles up any JSON
parsing errors.
prettyValue : Config -> Json.Encode.Value -> Result String String
Formats a Json.Encode.Value
. Internally passes the string through
Json.Decode.decodeValue
and bubbles up any JSON parsing errors.