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
If I create a packedString of a JSON object using JSONC as so:
var packedString = JSONC.pack(JSONObject)
Then I send this packedString to a Ruby on Rails server and try to "unpack" it back to the JSON object, I am running into problems.
I've tried in controller action
packed_string = params["packedString"]
gz = Zlib::GzipReader.new(StringIO.new(packed_string)) # errors out here with Zlib::GzipFile::Error: not in gzip format
uncompressed_string = gz.read
json = JSON.parse(uncompressed_string)
I've also tried to decode it first thinking the issue is that it is in base64 encoded format
packed_string = params["packedString"]
decoded_string = Base64.decode64(packed_string)
gz = Zlib::GzipReader.new(StringIO.new(decoded_string)) # errors out here with Zlib::GzipFile::Error: not in gzip format
uncompressed_string = gz.read
json = JSON.parse(uncompressed_string)
But in both cases Zlib::GzipReader doesn't think it is receiving something in a gzip format with the error message: Zlib::GzipFile::Error: not in gzip format
What should be done to properly unpack this on Ruby on Rails serve side?
The text was updated successfully, but these errors were encountered:
If I create a packedString of a JSON object using JSONC as so:
Then I send this packedString to a Ruby on Rails server and try to "unpack" it back to the JSON object, I am running into problems.
I've tried in controller action
I've also tried to decode it first thinking the issue is that it is in base64 encoded format
But in both cases Zlib::GzipReader doesn't think it is receiving something in a gzip format with the error message:
Zlib::GzipFile::Error: not in gzip format
What should be done to properly unpack this on Ruby on Rails serve side?
The text was updated successfully, but these errors were encountered: