0

I want to convert the data in webservice url ='http://services.groupkt.com/country/get/all' into xml format using Python / Unix. Please suggest.

Souvik Pal
  • 21
  • 3
  • 1
    Welcome to SO. Please show what code you have tried to get this to work – Fuzzybear Jul 23 '18 at 22:30
  • In unix i tried, curl -o data.xml "http://services.groupkt.com/country/get/all". to save the data in data.xml, but its did not get saved in proper xml format, just the data got fetched. – Souvik Pal Jul 23 '18 at 22:41
  • And i python I tried, import requests resp = requests.get('http://services.groupkt.com/country/get/all') with open('C:/Users/Souvik/PycharmProjects/NewProject/export.xml', 'wb') as foutput: foutput.write(resp.content) The same thing happened, just the data got saved in the format that is in the webservice, not in xml format. – Souvik Pal Jul 23 '18 at 22:44

1 Answers1

0

The data you are trying to convert is in JSON format. There's already an answer to your question here

Rickx
  • 591
  • 1
  • 5
  • 7