3

I want to download the content from the following link to a file .

I tried using wget and curl commands , the file has downloaded data but is not in readable format or json string.

command I have used is :

    wget -O ~/ks/json.txt "http://api.geonames.org/postalCodeLookupJSON?postalcode=6600&country=AT&username=demo"

I want the output file to contain data in json format itself as shown in the link.

EDIT

I used Vi editor to read the output , below is the sample i got as output :

^_<8b>^H^@^@^@^@^@^D^@Õ[^?wÚ8³þ*ºì<9e>¾d^Wÿ¶1Ð$û¦MÚdÛ$½MÚݾKO<8e>°^E(16kË¡´§÷³ß^YÉ^F^C&%ÙûÏÍÙ-F<9e>^Y<8d>¤<99>G3#ñ­Á^E<9b>d<8d>Þ_ß^Z<82><8e>ð¡1¦a<92>L^[­Æ<84>NS^Væ^A<83>ç9MãÆçV#<99>Å,mô¾5R6Í^E^U<<89>^[=Ûi5ò<8c>¥7<lô^\ÏqÝvÙ"æSÖè^Aõ<88>g<82><81>8<90>E<83><80>MÅMJ^E¼ò;­Æ4M<86><b7|BGH=^Vb<9a>õ^Lc6<9b>é£<94>ÞSAS=H&<86>z4Âд¼6^[ºf7^XZagà<87>~×¶CÚa<8e>^[Ø<83>ß²^CËî<^K^OxÈbÁ<83>$~<96>^^¼{ýlx`A÷!Ϧ^Q<9d>ßÄt<82><9d>½&oR<9e><8d>cJ®èdJÅ^XH"^^ß^Uz<80>^Z<99> Á]rÏÒa<94>̤^^8´Ì(Fj<8c>´;%AË
3
  • It is working for me. I am using vi editor. Which editor u used to open the file. Commented Jan 13, 2015 at 8:00
  • I used VI itself but still , the output im getting I have added in question. Commented Jan 14, 2015 at 7:04
  • I think encoding settings of your vi editor is not correct. Check this may be helpful stackoverflow.com/questions/1174847/… Commented Jan 14, 2015 at 9:45

2 Answers 2

6
$ curl -X GET "http://api.geonames.org/postalCodeLookupJSON?postalcode=6600&country=AT&username=demo" > out.json
Sign up to request clarification or add additional context in comments.

1 Comment

Dint help , The output is not in a readable format , I update the question with the output.
0

Using curl the payload is saved and readable by a JSON parser (node in my case)

curl "http://api.geonames.org/postalCodeLookupJSON?postalcode=6600&country=AT&username=demo" > file.json

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.