Support custom newline symbol(s) for format option
This commit is contained in:
parent
528d5b8253
commit
5dbb9b5f24
3 changed files with 22 additions and 4 deletions
|
@ -572,8 +572,9 @@ format(JSON) -> JSON
|
|||
format(JSON, Opts) -> JSON
|
||||
|
||||
JSON = json_text()
|
||||
Opts = [option() | space | {space, N} | indent | {indent, N}]
|
||||
N = pos_integer()
|
||||
Opts = [option() | space | {space, N} | indent | {indent, N} | {newline, LF}]
|
||||
N = pos_integer()
|
||||
LF = binary()
|
||||
```
|
||||
|
||||
`format` parses a json text (a `utf8` encoded binary) and produces a new json
|
||||
|
@ -586,6 +587,9 @@ the option `{indent, N}` inserts a newline and `N` spaces for each level of
|
|||
indentation in your json output. note that this overrides spaces inserted after
|
||||
a comma. `indent` is an alias for `{indent, 1}`. the default is `{indent, 0}`
|
||||
|
||||
the option `{newline, LF}` defines a custom newline symbol(s).
|
||||
the default is `{newline, <<$\n>>}`
|
||||
|
||||
raises a `badarg` error exception if input is not valid json
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue