Help TypeError: string indices must be integers in Python



I am very new to programming and I am having a problem with the following:

I have a very simple and perhaps pointless task whereby I am trying to take longitude and latitude data from a JSON API and write to a CSV file. I have based the code on another that seems to work OK.

I keep getting the following error code: _
c.writerow([item['latitude']])_TypeError: string indices must be integers

Can anyone help me??

1.JSON API from

"iss_position": {
"latitude": 17.03894678089794,
"longitude": 1.17550020887323
"message": "success",
"timestamp": 1463137065

2.My Python Code

import requests
import csv

r = requests.get("").json()

c = csv.writer(open("ISS.csv", "w"),lineterminator='\n')

for item in r['iss_position']:


3.Error Message

C:\Python35\python.exe C:/Users/Ian/PycharmProjects/ISS/
Traceback (most recent call last):
File "C:/Users/Ian/PycharmProjects/ISS/", line 10, in
TypeError: string indices must be integers

Process finished with exit code 1

Replace this line with your code.


'hello'[3]  # OK
'hello'['kebab']  # error