Comments (2)
And I would be perfectly ok with this being opt-in: JSON.generate(..., type_smuggling: true)
from json.
I don't think the JSON gem should support this. It sounds like a reasonable thing to do for Sidekiq but is too specific for a general JSON gem (hard to draw a line for which specific classes/types this should/shouldn't support) and isn't part of the standard. The good news is that this seems best implemented in pure-Ruby wherever it lives!
One problem this has is that if Ruby's {:mike => 123}
is represented as the JSON "_s:mike"
how do you represent the Ruby {"_s:john" => 456}
? Presumably with a different prefix but once that is done "standard" JSON isn't 1:1 loadable as "smuggled" JSON and you might as well have a heavier/specific format.
This would allow Sidekiq users to use keyword arguments in their jobs without any issues.
Keyword arguments probably also requires additional work/hacks/annotations, since in Ruby 3.0+ they'll need to be separated from your positional arguments (in which case you could just know the keys are Symbols) OR you'll have to round-trip the ruby2_keywords
value of the hash, which is what ActiveJob does.
from json.
Related Issues (20)
- JRuby extension fails to build on Windows HOT 1
- How to use both, pure and ext variant
- Streaming enhancements for dumping
- Behaviour change between 2.5.1 and 2.6.0
- Test
- JSON.parse Alters Encoding of Passed String Unexpectedly
- Shorten reference to input data in error message
- json-1.8.6/lib/json/common.rb:155:in `initialize': wrong number of arguments (given 2, expected 1) (ArgumentError) HOT 1
- CHANGES.md is not update for version 2.6.3
- https://www.example.com/proxy.pac
- JSON.dump does not work in version 2.7.0 when the argument is an implicit Hash HOT 5
- Wrong number of arguments for dump in 2.7.0 HOT 4
- JSON.dump inconsistent output for hash
- Compatibility with new ruby 3.3.0
- JSON additions do not recurse HOT 4
- README references file which does not exist HOT 1
- Cannot convert time to json
- Making OpenStruct as optional break things HOT 3
- strict option is broken for pure-Ruby implementation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json.