03-02-2023 03:42 PM
Hello All,
I have file called “filename.json.gz” which is obtained using REST GET Snap and I need to convert it to a CSV format file. I need this transformation to be done in one pipeline.
Any help would be greatly appreciated. Thanks!!
Solved! Go to Solution.
03-03-2023 10:34 AM
GZip stuff is a little bit more work, but it’s possible here, you’ll want to set the REST Get Response Entity Type to BINARY
With that, you’ll then have to map the data from the output document to content for a document to binary transition, to do this, you’ll want to map the settings in the mapper (some of these are optional, but I’d say content-type
, content-encoding
, and content
are all required on the output map)
With that, you can use the Document to Binary to get it in a binary form (I set the drop-down for Encode or Decode to NONE), then decompress (you select GZip), then you can parse the JSON with the JSON Parser.
Full pipeline screenshot
download (you’ll need to change the URL to download in the REST Get)
json gzip_2023_03_03.slp (8.0 KB)
03-03-2023 06:06 AM
Hi @deepthi.chidi.
You can try by splitting the entity from the Rest Get Response and then using CSV Formatter.
Let me know if this helps you.
BR,
Aleksandar.
03-03-2023 10:18 AM
Hello Aleksandar,
I did try but it didn’t work.
Here is how my REST SNAP output looks like and I need to read data that’s in filename="Test_2023_02_10.json.gz\
[{“statusLine”:{“protoVersion”:“HTTP/1.1”,“statusCode”:200,“reasonPhrase”:“OK”},“entity”:“abcd”,
“headers”:{“vary”:“Accept-Encoding”,“x-powered-by”:“153.1”,“x-accepted-oauth-scopes”:“analytics:read”,“transfer-encoding”:“chunked”,“pragma”:“private”,“via”:“envoy, envoyozak”,“date”:“Fri, 03 Mar 2023 GMT”,“x-oauth-scopes”:“identify.analytics:read”,“content-disposition”:“attachment; filename="Test_2023_02_10.json.gz"; filename*=utf-8’'Test%202023-02-10.json.gz”,“access-control-allow-headers”:“hyyuy”}}]
Thank you !
03-03-2023 10:34 AM
GZip stuff is a little bit more work, but it’s possible here, you’ll want to set the REST Get Response Entity Type to BINARY
With that, you’ll then have to map the data from the output document to content for a document to binary transition, to do this, you’ll want to map the settings in the mapper (some of these are optional, but I’d say content-type
, content-encoding
, and content
are all required on the output map)
With that, you can use the Document to Binary to get it in a binary form (I set the drop-down for Encode or Decode to NONE), then decompress (you select GZip), then you can parse the JSON with the JSON Parser.
Full pipeline screenshot
download (you’ll need to change the URL to download in the REST Get)
json gzip_2023_03_03.slp (8.0 KB)
03-03-2023 12:01 PM
Thank you, it worked.