@@ -298,12 +298,12 @@ def inside(chars, delim, type)
298298 # Certain versions of Ruby and of the pure_json gem not support loading
299299 # scalar JSON values, such a numbers, booleans, strings, etc. These
300300 # simple values must be first wrapped inside a JSON object before calling
301- # `JSON.load `.
301+ # `JSON.parse `.
302302 #
303303 # # works in most JSON versions, raises in some versions
304- # JSON.load ("true")
305- # JSON.load ("123")
306- # JSON.load ("\"abc\"")
304+ # JSON.parse ("true")
305+ # JSON.parse ("123")
306+ # JSON.parse ("\"abc\"")
307307 #
308308 # This is an known issue for:
309309 #
@@ -317,12 +317,12 @@ def inside(chars, delim, type)
317317 # causes issues in environments that cannot compile the gem. We previously
318318 # had a direct dependency on `json_pure`, but this broke with the v2 update.
319319 #
320- # This method allows us to detect how the `JSON.load ` behaves so we know
320+ # This method allows us to detect how the `JSON.parse ` behaves so we know
321321 # if we have to wrap scalar JSON values to parse them or not.
322322 # @api private
323323 def self . requires_wrapping?
324324 begin
325- JSON . load ( 'false' )
325+ JSON . parse ( 'false' )
326326 rescue JSON ::ParserError
327327 true
328328 end
@@ -332,12 +332,12 @@ def self.requires_wrapping?
332332 def parse_json ( token , quoted = false )
333333 begin
334334 if quoted
335- token . value = JSON . load ( "{\" value\" :#{ token . value } }" ) [ 'value' ]
335+ token . value = JSON . parse ( "{\" value\" :#{ token . value } }" ) [ 'value' ]
336336 else
337337 begin
338- token . value = JSON . load ( "{\" value\" :#{ token . value } }" ) [ 'value' ]
338+ token . value = JSON . parse ( "{\" value\" :#{ token . value } }" ) [ 'value' ]
339339 rescue
340- token . value = JSON . load ( sprintf ( '{"value":"%s"}' , token . value . lstrip ) ) [ 'value' ]
340+ token . value = JSON . parse ( sprintf ( '{"value":"%s"}' , token . value . lstrip ) ) [ 'value' ]
341341 end
342342 end
343343 rescue JSON ::ParserError
@@ -349,9 +349,9 @@ def parse_json(token, quoted = false)
349349 def parse_json ( token , quoted = false )
350350 begin
351351 if quoted
352- token . value = JSON . load ( token . value )
352+ token . value = JSON . parse ( token . value )
353353 else
354- token . value = JSON . load ( token . value ) rescue JSON . load ( sprintf ( '"%s"' , token . value . lstrip ) )
354+ token . value = JSON . parse ( token . value ) rescue JSON . parse ( sprintf ( '"%s"' , token . value . lstrip ) )
355355 end
356356 rescue JSON ::ParserError
357357 token . type = T_UNKNOWN
0 commit comments