May-06-2019, 10:39 AM
Hello ,
I want to read a json file and get 2 objects form the file (username and IP )
the config.json is :
this is what I did to read the all file :
so what am I missing?
Thanks,
I want to read a json file and get 2 objects form the file (username and IP )
the config.json is :
Output:{
"IP":"172.16.3.1",
"username" : "admin",
"password" : "Root",
"Remote":"172.16.3.254",
"internalNumber":31",
"comId":2,
}
how do I do this? this is what I did to read the all file :
import json with open('/home/pi/Documents/config.json') as json_file: data = json.load(json_file) print(data)I have also try to use:
j = json.loads('/home/pi/Documents/config.json') print (j['IP'])but I get error
so what am I missing?
Thanks,