pkpass: Unknown encoding of JSON format (iOS Wallet pass file)

610 views Asked by At

I am trying to open a .pkpass file (or merely the contained pass.json file) in an app I am developing, however, while I didn't have issues with 3 passes I tried, the 4th seems to have some kind of weird encoding and/or binary data within the JSON.

When I open the JSON file using e.g. less in the shell, I'll get this:

enter image description here

And while we can see mostly garbage, there is readable characters mixed into it. When I open it using XCode, this is what I get:

enter image description here

This leads me to believe its a character encoding issue. But I am not too good in text encoding, so I don't know how I can find out the correct encoding in order to be able to properly read this file with my app. file is giving me:

$ file -I pass.json 
pass.json: application/octet-stream; charset=binary

I tried opening the file with BBedit over and over again with different encodings, none would open it in a readable format.

What kind of format is this, or how can I find out, so I can implement the correct method of opening/parsing this file?

1

There are 1 answers

3
olidroide On

I feel you're encondind the file pass.json charset as a binary, and this file must be a charset for text like this:

pass.json: application/json; charset=us-ascii

Check your how you are generating the package of .pkpass file because maybe you are zip or compress every file inside the package instead package all the required files.

Could you post more about code of how you are generating the .pkpass file?