How do I format my JSON output so that it looks human readable and I have a JSON file that looks like this:
{
"user1":{
"Country":[
"China", "USA", "Nepal"
],
"Name": [
"Lisbon"
]
},
"user2":{
"Country":[
"Sweden", "China", "USA"
],
"Name": [
"Jade"
]
},
"user3":{
"Country":[
"India", "China", "USA"
],
"Name": [
"John"
]
}
Here's my code:
user = raw_input("Enter user's name: ")
with open('Users.json') as f:
data = json.load(f)
for k, v in data.items():
if any(x in data[user]['Country'] for x in v['Country']):
print(v['Name'])
So far my output looks like this:
[u'Lisbon']
[u'Jade']
[u'John']
I would like an output that looks like this, how do I go around that?:
Lisbon
Jade
John