diff options
Diffstat (limited to 'ext/json/lib')
-rw-r--r-- | ext/json/lib/json.rb | 9 | ||||
-rw-r--r-- | ext/json/lib/json/common.rb | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/ext/json/lib/json.rb b/ext/json/lib/json.rb index 1e64bfcb1a..807488ffef 100644 --- a/ext/json/lib/json.rb +++ b/ext/json/lib/json.rb @@ -285,6 +285,15 @@ require 'json/common' # # Raises JSON::NestingError (nesting of 2 is too deep): # JSON.generate(obj, max_nesting: 2) # +# ====== Escaping Options +# +# Options +script_safe+ (boolean) specifies wether <tt>'\u2028'</tt>, <tt>'\u2029'</tt> +# and <tt>'/'</tt> should be escaped as to make the JSON object safe to interpolate in script +# tags. +# +# Options +ascii_only+ (boolean) specifies wether all characters outside the ASCII range +# should be escaped. +# # ====== Output Options # # The default formatting options generate the most compact diff --git a/ext/json/lib/json/common.rb b/ext/json/lib/json/common.rb index 173af04be0..68ff0efcd0 100644 --- a/ext/json/lib/json/common.rb +++ b/ext/json/lib/json/common.rb @@ -572,13 +572,13 @@ module JSON # Sets or returns the default options for the JSON.dump method. # Initially: # opts = JSON.dump_default_options - # opts # => {:max_nesting=>false, :allow_nan=>true, :escape_slash=>false} + # opts # => {:max_nesting=>false, :allow_nan=>true, :script_safe=>false} attr_accessor :dump_default_options end self.dump_default_options = { :max_nesting => false, :allow_nan => true, - :escape_slash => false, + :script_safe => false, } # :call-seq: |