Convert JSON to CSV using Microsoft Flow - json

I am trying to parse JSON data from an API into Flow, convert it into a CSV and then output the CSV to my Google Drive.
The API I am trying to work with is located here:
https://www.binance.com/api/v1/klines?symbol=BNBBTC&interval=1h&limit=24
Is this possible using Microsoft flow? I have tried various things without much success.
Thanks in advance.

I'd say it is possible. What have you tried so far?
First you have to get the response body. Then extract the "meat" from each element, which has to be done with flow expressions "body(response_body)[0]" - depending on format. Then feed all these data parts to a newly created excel file.

Related

How to Read CSV file using Power Automate?

I have added CSV file to SharePoint Documents library.
I needs to read that CSV file using Power Automate / Flow.
I have created Power Automate flow. Below is the screenshot fro the same.
Which CSV parser do i need to use for read data from file content action?
Can anyone help me for the same?
Thanks
If you want to retrieve the content of the CSV without a premium connector you could use an expression to convert the $content property of the Get File Content action into a string value. You can use the base64tostring function for this.
Below is an example
base64tostring(outputs('Get_file_content')?['body']['$content'])

Nifi processor for converting xlsb to csv

I am trying to convert the xlsb files in Nifi to csv. I am using ConvertExcelToCSVProcessor in Nifi at the moment, but it gives me error and does not work. xlsb are the excel binary files. i have googled a lot and tried to make this work, but in vain. please help in this regard.
I just looked through our code base and checked up on POI. The long and short of it is that XLSB support in POI is fairly limited at this point, and the APIs that NiFi calls don't appear to support it. What you can try as a work around for now is look for a Python library that supports XLSB, write a Python script that generates XLSX or CSV from that and call that with ExecuteStreamCommand.

What does a JSON file do?

I went through previous posts on SO and some of the answers say that a JSON file is used to send data from server to client.
Well that seems to be okay but then we can create package.json, Apidoc.json, manifest.json which do not interact with the client and server
So can someone tell me what actually is a JSON file?
JSON stands for JavaScript Object Notation. It is used to describe a data structure in a simple format. It can be a plain text file, which may be used to pass data from the server to a client, but it could be equally used to hold and consume that data at the same layer e.g. you could have a configuration file at the client side which is read an interpreted by your application.
Note also that JSON does not need to be held in a file; you could create a string variable with JSON data in it and pass this from one method to another without ever storing it in a file.
The tag definition in Stack Overflow can be found here https://stackoverflow.com/tags/json/info and further information can be found here https://www.json.org/.
JSON is a file format, just like CSV. Just because CSV is used with Microsoft Excel, does not mean that is all it is used for (just like with JSON). Just because it is common to get info from a server in JSON format, does not mean that is all JSON is used for. Do some googling before asking a question like this on Stack Overflow.
Here is an intro to JSON. JSON Intro W3Schools

Converting JSON txt file to XML

We're constructing a network of data and part of that includes modifying a search query from a public website to pull all of the data we want. That data, however, when pulled is stored into a JSON txt file.
Ultimately we want this data to be stored in an Access Database so the next step, we thought, was to convert it to XML so we can have an Excel sheet to import. We found a formatting tool (http:jsonformatter.org). When running the tool we received the following error:
“Microsoft Access has encountered an error processing the XML schema in file ‘Data.xml’,
A document must contain exactly one root element”
I've no idea what this entails or where to start debugging. Are there alternatives we might consider?
The error says that there is more than one root element. Have you validated the XML generated? I looked at the website. I tried to ask via comment but I don't have enough rep but you should post some of your json and xml.
If I am reading your issue correctly, you are converting json to xml format and then to excel?
I would suggest writing some code to consume the json and export the xml files to import.

Does LibreOffice Calc support JSON file importing/sorting?

I've been trying to import a couple of .json files into LibreOffice Calc.
Although I can get the raw data in, it isn't sorting as I would think it might (by placing different pieces of info into each cell).
Does LibreOffice provide support for importing JSON files and sorting them out in cells? (In other words, import + sort)?
If there doesn't seem to be direct support for this, would converting to CSV be the next logical step in order to get the data into Calc?
Had the same problem myself (that's how I found this question).
So, for the next person finding this - the answer is no - LibreOffice Calc does not support direct import of JSON.
And the next logical step indeed is converting to CSV. There are free online JSON to CSV converters, and using one of them (http://www.convertcsv.com/json-to-csv.htm), I was easily able to make a correct CSV which Calc imports without a problem.
One possible caveat is if you have complex objects represented in JSON - that may not be convertible to CSV, but then again, if it doesn't fit into CSV, it probably doesn't fit into spreadsheet format either.
There's a LibreOffice GetRest plugin with documentation written in broken English, that has a "parseJSON" formula. It won't convert JSON to CSV (without a lot of grunt work) but it might help your use case.
If you can run Python scripts in Libreoffice Calc, then it should be possible when you see what's in here: http://blog.appliedinformaticsinc.com/how-to-parse-and-convert-json-to-csv-using-python/