-1

I am looking for general guidance/instructions, not necessarily actual code. The answer might be: "you can't", or if doable, some instructions to what steps should be done. I have downloaded, manually, an Azure blob file (05.JSON) to local drive. The blob contains device telemetry messages in JSON format. If I view the raw blob, I cannot se those messages of course. How to retrieve the original messages JSON in Python? Or can I? I tried loading the blob into Pandas data frame using Pandas.read_csv("05.json"). It loaded it, but still in the blob raw structure i.e. cannot see the original messages in their JSON structure.

Update: I have just found out the the blob CONTENT-TYPE is application/octet-stream so I think that's why I am not seeing the expected JSON structure in the blob <

user13160236
  • 1
  • 1
  • 5
  • 1
    We have no info about what the file (05.JSON) contains – rv.kvetch Oct 07 '21 at 21:01
  • 1
    Files in blob storage are just files - there's no such thing as an Azure blob file, so your problem seems to be with .json files in general? Why would you use `read_csv` to read a .json, instead of `pandas.io.json.read_json`? – Grismar Oct 07 '21 at 21:07
  • have you tried just reading the data using the built-in json parser? https://stackoverflow.com/questions/20199126/reading-json-from-a-file – Taylor Cochran Oct 07 '21 at 21:25
  • Thanks all for the hints and suggestions. I found out that the CONTENT-TYPE application/octet-stream and not text or JSON. That is why I get ASCII codes in the blob and not the expected JSON structure. I need to figure out how to decode this octet stream. – user13160236 Oct 08 '21 at 00:13

1 Answers1

0

I found out that Azure IoT hub by default saves blobs in an encoded CONTENT TYPE = application/octet-stream, which is why I see meaningless ASCII characters instead of the original JSON. The CONTENT TYPW must be set tp application/json in order to save the blob in the JSON format.

user13160236
  • 1
  • 1
  • 5