You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I apologize if this is not the correct place to post this, I think this may be more of a configuration problem or something that's just not supported, more than an "issue", per-se.
I am attempting to upgrade to Oj 3.x.x in a Rails application that is sorely out-of-date with regards to it's dependencies :(, and I'm running into an issue related to Oj.
The application is using JSON.dump/load to serialize/deserialize data in the model (i.e. serialize :property, MySerializerUsingJSON) as well as JSON.load/parse in a number of places. So far, there is at least one type that is being serialized differently than in 2.17.5: ActiveSupport::TimeWithZone.
With Oj 2.17.5 & the oj_mimic_json gem installed, JSON.dump would use Oj and the value would be formatted in ISO8601. However, with Oj 3.12.1 & 'Oj.optimize_rails`, the format is quite different. I'm guessing this is likely a case where Oj was not compatible with JSON, so it ended up being changed in 3.x.
Is there any way to configure Oj 3.x to ensure that use of JSON will serialize/deserialize ActiveSupport::TimeWithZone(and other types) as shown in 2.17.5, below?. I've not been able to determine how, if there is.
I could change the serialization to use Oj directly instead of JSON, but I'm not sure what other differences there may be.
Below are some examples of behaviour with version 2.17.5 and 3.12.1
This behavior changed in #654 to make Oj consistent with JSON when using mimic_JSON. Using to_json instead of JSON.generate / JSON.dump may be one way to work around this for ActiveSupport::TimeWIthZone.
I apologize if this is not the correct place to post this, I think this may be more of a configuration problem or something that's just not supported, more than an "issue", per-se.
I am attempting to upgrade to Oj 3.x.x in a Rails application that is sorely out-of-date with regards to it's dependencies :(, and I'm running into an issue related to Oj.
This may be similar to: #390
The application is using
JSON.dump/load
to serialize/deserialize data in the model (i.e.serialize :property, MySerializerUsingJSON
) as well asJSON.load/parse
in a number of places. So far, there is at least one type that is being serialized differently than in 2.17.5:ActiveSupport::TimeWithZone
.With Oj 2.17.5 & the
oj_mimic_json
gem installed,JSON.dump
would use Oj and the value would be formatted in ISO8601. However, with Oj 3.12.1 & 'Oj.optimize_rails`, the format is quite different. I'm guessing this is likely a case where Oj was not compatible with JSON, so it ended up being changed in 3.x.Is there any way to configure Oj 3.x to ensure that use of JSON will serialize/deserialize
ActiveSupport::TimeWithZone
(and other types) as shown in 2.17.5, below?. I've not been able to determine how, if there is.I could change the serialization to use Oj directly instead of JSON, but I'm not sure what other differences there may be.
Below are some examples of behaviour with version 2.17.5 and 3.12.1
Oj 2.17.5 without
mimic_JSON
called:Oj 2.17.5 with
mimic_JSON
called:Oj 2.17.5 Before and after
mimic_JSON
Oj 3.12.1 with
optimize_rails
Environment:
The text was updated successfully, but these errors were encountered: