java - Save JSON outputed from a URL to a file -


How do I save Jason to a file in a file?

For example, from Twitter Search API (this)

The language is not important.

Thank you!

How will I edit / add more updates to eof?

Edit 2 // People with great answers really, but whatever I thought was the most beautiful. Thanks! :)

It is easy in any language, but the mechanism is different. Wget and with a shell:

  wget 'http://search.twitter.com/search.json?q=en' -o hi.json  

To add:

  wget 'http://search.twitter.com/search.json?q=en' -O - & gt; & Gt; Hi.json  

With Python:

  urllib.urlretrieve ('http://search.twitter.com/search.json?q=en ',' Hi.json ')  

to add:

  hi_web = urllib2.urlopen (' http://search.twitter.com/ Search? Json q = hi '); Hi_file with Open ('hi.json', 'ab'): hi_file.write (hi_web.read ())  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -