Curl command, Json data to excel

Hi there,

I’m using the curl command to get data behind a graph on a website.

curl -k -u 'sensor:xxxxx' 'http://website&json'

This returns it as a json object in the terminal window which I’m not familiar with.

What I would like to do is to write the data into a text file that I can import into excel etc.

Would anybody be able to advise me how to do this?

I’ve tried writing it to a text file. Is this correct? where does the file get saved to?

curl -k -u 'sensor:xxxxx' 'http://website' -o output.txt

thanks

Hi Steve,

yes you can use:

curl -k -u 'sensor:xxxxx' 'http://website' -o output.txt

to store output to output.txt file. This file will be created in your current working directory. You can also specify full path to file eg:

curl -k -u 'sensor:xxxxx' 'http://website' -o /tmp/output.txt

and the file will be stored in /tmp/ directory. To save your output to your home directory use:


curl -k -u 'sensor:xxxxx' 'http://website' -o ~/output.txt

I would suggest to store your output as output.json first and then convert it from JSON to CSV before importing it to excel.

hope this helps

Lubos