Weird IPFS JSON results

Hello,

I am trying to do a ‘round trip’ of a JSON file I am trying to upload to IPFS through Infura.

I do the following commands:

curl “https://ipfs.infura.io:5001/api/v0/add” -F file="{‘example’ : ‘json’}"

Getting an IPFS hash: QmW61xHTM11JwmTnGCD3J2uyYNJQwR3CmmbEwZbPBaXXiD

and then

curl “https://ipfs.infura.io:5001/api/v0/get?arg=QmW61xHTM11JwmTnGCD3J2uyYNJQwR3CmmbEwZbPBaXXiD” --output -

but the second command gives me a bunch of unexpected junk output before my json:

QmW61xHTM11JwmTnGCD3J2uyYNJQwR3CmmbEwZbPBaXXiD0000644000000000000000000000002414042176040016677 0ustar0000000000000000{‘example’ : ‘json’}

What exactly is going on here? Is there an API call or curl flag that will let me just get my original Json back?

1 Like

Have you figured this out? I am having the same problem when querying using /api/v0/get. Every single token has a different series of strange characters before or after the JSON object. I feel I am missing something because there is no way this is just how it was designed. Thanks!

hey, try cat instead of get which should return the exact data: curl -X POST “https://ipfs.infura.io:5001/api/v0/cat?arg=QmW61xHTM11JwmTnGCD3J2uyYNJQwR3CmmbEwZbPBaXXiD

See more details here: https://github.com/ipfs/go-ipfs/issues/4115