savonrb / nori

XML to Hash translator
MIT License
245 stars 74 forks source link

Nori::StringWithAttributes should implement `#as_json` #99

Closed HarlemSquirrel closed 1 week ago

HarlemSquirrel commented 1 year ago

Sidekiq 7 now requires that arguments serialize "safely" to JSON. This means they need to become basic types such as String.

Right now, trying to send an object with a Nori::StringWithAttributes to a Sidekiq worker queue raises an ArgumentError with something like

Job arguments to SomeWorker must be native JSON types, but "OK" is a Nori::StringWithAttributes. See https://github.com/sidekiq/sidekiq/wiki/Best-Practices To disable this error, add Sidekiq.strict_args!(false) to your initializer.

pcai commented 1 month ago

Coming back to this: if you need lossless transmission of some data:

If you are OK with losing some data:

I'm looking at the history of this project and can only conclude that seamless serialization/deserialization of parsed data in memory is not really in scope, since we already have a solution for that: XML.

Thoughts? Am I missing a perspective here?

pcai commented 1 week ago

See above