Quantcast
Channel: Power Query topics
Viewing all articles
Browse latest Browse all 30966

Change JSON Blob data during import

$
0
0

Hi,

 

I'm trying to import data from an Azure Blob Storage.

The files that are getting imported are JSON files, with one entry on each line.

 

They are lacking 2 things : 

  • An opening "[" and a closing "]" for it to be interpreted as a table
  • A comma "," at the end of each line

If I add those things (using search and replace in a text editor for example), the file becomes a valid .json file.

However, I have no idea how to do these operations in M on the "Combined Binaries" that I have imported. Using Replacer.ReplaceText throws an error (because my Binary files aren't text), and choosing to Transform the column type of my binary content to Text doesn't work.

 

If I try to use the Json.Document function as-is, it throws an error at the end of the first line, because it finds a "{" instead of a ",".

 

My json files are formatted as follows :

 

{"Event":"data1","Payload":{"Code":"data1","Context":"data1"}}

{"Event":"data2","Payload":{"Code":"data2","Context":"data2"}}

 

Is there a solution to my issue ?


Viewing all articles
Browse latest Browse all 30966

Trending Articles