-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Description
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?
Metadata
Metadata
Assignees
Labels
No labels