diff options
| author | Jean Boussier <jean.boussier@gmail.com> | 2025-12-22 09:16:09 +0100 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2025-12-26 11:00:51 +0900 |
| commit | 4d7db86a794581f1be405dcc70bb06549b8cf28f (patch) | |
| tree | e92c40e21b24d8839762f098cd51ca35643ed486 /ext | |
| parent | 8ccfb375b9ade4504c4012ce8c31adc7e12dc49c (diff) | |
[ruby/json] Add missing documentation for `allow_control_characters` parsing option
https://github.com/ruby/json/commit/a5c160f372
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/json/lib/json.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/json/lib/json.rb b/ext/json/lib/json.rb index 43d96afa95..f619d93252 100644 --- a/ext/json/lib/json.rb +++ b/ext/json/lib/json.rb @@ -173,6 +173,18 @@ require 'json/common' # When enabled: # JSON.parse('[1,]', allow_trailing_comma: true) # => [1] # +# --- +# +# Option +allow_control_characters+ (boolean) specifies whether to allow +# unescaped ASCII control characters, such as newlines, in strings; +# defaults to +false+. +# +# With the default, +false+: +# JSON.parse(%{"Hello\nWorld"}) # invalid ASCII control character in string (JSON::ParserError) +# +# When enabled: +# JSON.parse(%{"Hello\nWorld"}, allow_control_characters: true) # => "Hello\nWorld" +# # ====== Output Options # # Option +freeze+ (boolean) specifies whether the returned objects will be frozen; |
