I am extracting some data from my JSON file placed locally on my PC: and structure is:
JSON DATA SAMPLE
{ "totalRecords": 1,
"items": [{
"name": "Services Ltd",
"country": "GB",
"city": "Evesham",
"zip": "WR11 1BY",
"address": "Northwick House\r\rCoopers Lane"
}]
}
Python Script
import json
from pprint import pprint
fileName = r'naturesmenu.json'
with open(fileName, 'r') as f:
data = json.load(f)
dataData = data["items"]
c = 1
for i in dataData:
# pprint(i)
name = i['name']
address = i['address']
print(address)
for:
address = i['address']
Output should be:
Northwick House\r\rCoopers Lane
or if it removes/ has the effect of carriage return then output should look like this:
Northwick House
Coopers Lane
but I'm getting only this output:
Coopers Lane
not the full value corresponding to address
.
What am I doing wrong can someone point out? thanks