Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json 1.8.6 produces a deprecation on ruby 2.7 #399

Closed
scudco opened this issue Dec 30, 2019 · 11 comments
Closed

json 1.8.6 produces a deprecation on ruby 2.7 #399

scudco opened this issue Dec 30, 2019 · 11 comments

Comments

@scudco
Copy link

scudco commented Dec 30, 2019

https://github.com/flori/json/blob/7f4cfd853f2c919d854fb95548a19980feff17e8/lib/json/common.rb#L155

This line produces the following deprecation message:

<snip>/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated

It'd be nice to get a patch-level bump to silence this particular deprecation.

@mike-loopvoc
Copy link

This same problem occurs in version 2.2. What is strange is that it appears to be immune to setting RUBYOPT='-W:no-deprecated -W:no-experimental' - the deprecation messages print like crazy anyway (and I have seen it suppress the same messages from every other source that was producing them.)

@leoplct
Copy link

leoplct commented Jun 8, 2020

+1 It appears everywhere

@rdp
Copy link

rdp commented Jun 24, 2020

Please it's so chatty...

@hsbt
Copy link
Member

hsbt commented Jun 25, 2020

I'm not sure what maintenance status about v1.8 by flori as primary owner.

At least, I have no plan to maintain json-1.8.x in 2020. I suggest to upgrade json-2.3.0

@hsbt hsbt closed this as completed Jun 25, 2020
ghiculescu added a commit to ghiculescu/adp-connection-ruby that referenced this issue Jul 16, 2020
Doing so is making it hard to upgrade to ruby 2.7. See ruby/json#399
@miguelpeniche
Copy link

Any solutions?

@hsbt
Copy link
Member

hsbt commented Oct 14, 2020

Use json-2.x.

@joevandyk
Copy link

There's a lot of gems that still require json ~> 1.8... would be very nice to have a 1.8.7 that fixes this particular warning.

@airblade
Copy link

Using Rails, this seems to get rid of the warnings:

# config/initializers/json.rb
module JSON
  module_function

  def parse(source, opts = {})
    Parser.new(source, **opts).parse
  end
end

@joemsak
Copy link

joemsak commented Feb 23, 2021

@airblade For me, your solution was no dice :(

9toon added a commit to 9toon/hypernova-ruby that referenced this issue Feb 23, 2021
Because json-1.8.x gem produces a deprecation warning on Ruby 2.7.
see: ruby/json#399
9toon added a commit to 9toon/hypernova-ruby that referenced this issue Feb 23, 2021
Because json-1.8.x gem produces a deprecation warning on Ruby 2.7.
see: ruby/json#399
9toon added a commit to 9toon/hypernova-ruby that referenced this issue Feb 23, 2021
Because json-1.8.x gem produces a deprecation warning on Ruby 2.7.
see: ruby/json#399
9toon added a commit to 9toon/hypernova-ruby that referenced this issue Feb 28, 2021
Because json-1.8.x gem produces a deprecation warning on Ruby 2.7.
see: ruby/json#399
@andregit1
Copy link

Using Rails, this seems to get rid of the warnings:

# config/initializers/json.rb
module JSON
  module_function

  def parse(source, opts = {})
    Parser.new(source, **opts).parse
  end
end

you're solutions really saved my day !

bazay added a commit to bazay/json that referenced this issue Mar 21, 2021
bazay added a commit to SohoHouse/json that referenced this issue Mar 21, 2021
luisramos0 added a commit to luisramos0/openfoodnetwork that referenced this issue Jun 4, 2021
Using this patch ruby/json#399 (comment)

We can upgrade to json v2 but to do that we need to switch from aws-sdk-v1 to aws-sdk-s3 first
luisramos0 added a commit to luisramos0/openfoodnetwork that referenced this issue Jun 4, 2021
Using this patch ruby/json#399 (comment)

We can upgrade to json v2 but to do that we need to switch from aws-sdk-v1 to aws-sdk-s3 first
ehundt added a commit to ehundt/gartenkalender that referenced this issue Aug 29, 2021
torrocus added a commit to futurelearn/hypernova-ruby that referenced this issue Jul 6, 2022
One commit that solves a few issues:

- Support faraday 1.x
- Update supported Ruby versions (only Ruby 2.5, 2.6, 2.7)
- Update webmock(~> 3.0) to fix an incompatibility with faraday-1.x
- Do not specify "json" gem's version,
  because json-1.8.x gem produces a deprecation warning on Ruby 2.7. [1]
- Drop public_suffix from dependencies.

[1]: ruby/json#399
@gentaro-sakamoto
Copy link

gentaro-sakamoto commented Apr 19, 2023

severin added a commit to severin/json that referenced this issue Feb 20, 2024
severin added a commit to onrunning/json that referenced this issue Apr 8, 2024
severin added a commit to onrunning/json that referenced this issue Apr 8, 2024
severin added a commit to onrunning/json that referenced this issue Apr 8, 2024
Based on ruby#399 (comment)

The `|| {}` bit makes sure that calls via `JSON(...)` continue to work:
when no second argument is passed to the `JSON(...)` call then
`JSON.parse` ends up being called with `opts=nil` which results in an
exception (cannot convert nil into hash).
severin added a commit to onrunning/json that referenced this issue Apr 9, 2024
Based on ruby#399 (comment)

The `|| {}` bit makes sure that calls via `JSON(...)` continue to work:
when no second argument is passed to the `JSON(...)` call then
`JSON.parse` ends up being called with `opts=nil` which results in an
exception (cannot convert nil into hash).
severin added a commit to onrunning/json that referenced this issue Apr 9, 2024
* Fix kwargs handling for ruby 3

Based on ruby#399 (comment)

The `|| {}` bit makes sure that calls via `JSON(...)` continue to work:
when no second argument is passed to the `JSON(...)` call then
`JSON.parse` ends up being called with `opts=nil` which results in an
exception (cannot convert nil into hash).

* Run CI for ruby 3

* Bump test-unit to version 3.X

* Fix handling of create_additions flag when nil is passed as opts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests