Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-19-2012, 01:25 AM   #1
LQ Newbie
Registered: May 2012
Posts: 19

Rep: Reputation: Disabled
How to read json files using python

I have a Json file that I download from the internet, as far as I know python has a library called json to handle these files.

I want for example to know the value of a field called "totalresults", how?

Or also to extract inner arrays... in java you can use jersey but I don't want to use that language.

Thanks a lot for the help.
Old 08-19-2012, 02:15 AM   #2
Senior Member
Registered: Feb 2009
Posts: 1,395

Rep: Reputation: 597Reputation: 597Reputation: 597Reputation: 597Reputation: 597Reputation: 597
import json
data = json.load(open("filename))

data it than composed out of dictionaries and arrays
so for accessing data you need to read about dictionaries and arrays

start reading here
and continue here
and maybe some examples you can find via your favourite search engine


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
samba does not keep windows attributes (read only files as read only for example) golden_boy615 Linux - General 3 07-17-2011 06:44 PM
[SOLVED] Read content from net in python vbx_wx Programming 3 01-08-2011 01:46 AM
problem with python and yum... please read?!!!!! negrito211 Linux - Software 2 02-17-2009 10:13 AM
read lines in python horacioemilio Programming 2 12-04-2007 07:03 AM
mozzla problems-can not read files online, can not read attachments sarajevo Linux - Software 1 09-20-2005 06:58 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:22 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration