document repeat_keys

This commit is contained in:
alisdair sullivan 2014-08-26 22:37:53 -07:00
parent e2ef23a46a
commit c15315fc28

View file

@ -341,13 +341,14 @@ the subset of [`token()`](#token) emitted by the decoder and encoder to handlers
#### `option()` #### #### `option()` ####
```erlang ```erlang
option() = escaped_forward_slashes option() = dirty_strings
| escaped_forward_slashes
| escaped_strings | escaped_strings
| unescaped_jsonp | repeat_keys
| dirty_strings | stream
| strict | strict
| {strict, [strict_option()]} | {strict, [strict_option()]}
| stream | unescaped_jsonp
strict_option() = comments strict_option() = comments
| trailing_commas | trailing_commas
@ -361,6 +362,15 @@ in all contexts, but they are always valid options. functions may have
additional options beyond these. see additional options beyond these. see
[individual function documentation](#exports) for details [individual function documentation](#exports) for details
- `dirty_strings`
json escaping is lossy; it mutates the json string and repeated application
can result in unwanted behaviour. if your strings are already escaped (or
you'd like to force invalid strings into "json" you monster) use this flag
to bypass escaping. this can also be used to read in **really** invalid json
strings. everything between unescaped quotes are passed as is to the resulting
string term. note that this takes precedence over any other options
- `escaped_forward_slashes` - `escaped_forward_slashes`
json strings are escaped according to the json spec. this means forward json strings are escaped according to the json spec. this means forward
@ -377,22 +387,13 @@ additional options beyond these. see
control codes and problematic codepoints and replacing them with the control codes and problematic codepoints and replacing them with the
appropriate escapes appropriate escapes
- `unescaped_jsonp` - `repeat_keys`
javascript interpreters treat the codepoints `u+2028` and `u+2029` as this flag circumvents checking for repeated keys in generated json
significant whitespace. json strings that contain either of these codepoints
will be parsed incorrectly by some javascript interpreters. by default,
these codepoints are escaped (to `\u2028` and `\u2029`, respectively) to
retain compatibility. this option simply removes that escaping
- `dirty_strings` - `stream`
json escaping is lossy; it mutates the json string and repeated application see [incomplete input](#incomplete-input)
can result in unwanted behaviour. if your strings are already escaped (or
you'd like to force invalid strings into "json" you monster) use this flag
to bypass escaping. this can also be used to read in **really** invalid json
strings. everything between unescaped quotes are passed as is to the resulting
string term. note that this takes precedence over any other options
- `strict` - `strict`
@ -424,9 +425,13 @@ additional options beyond these. see
any combination of these can be passed to **jsx** by using `{strict, [strict_option()]}`. any combination of these can be passed to **jsx** by using `{strict, [strict_option()]}`.
`strict` is equivalent to `{strict, [comments, bad_utf8, single_quotes, escapes]}` `strict` is equivalent to `{strict, [comments, bad_utf8, single_quotes, escapes]}`
- `stream` - `unescaped_jsonp`
see [incomplete input](#incomplete-input) javascript interpreters treat the codepoints `u+2028` and `u+2029` as
significant whitespace. json strings that contain either of these codepoints
will be parsed incorrectly by some javascript interpreters. by default,
these codepoints are escaped (to `\u2028` and `\u2029`, respectively) to
retain compatibility. this option simply removes that escaping
## exports ## ## exports ##