Python Forum
Error string indice must integers Json
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error string indice must integers Json
#3
Use code tag
Don't use decode of json.load() with Requests,theses are build into Requests.
Example:
import requests

url = 'https://api.github.com/'
url_get = requests.get(url)
json_data = url_get.json()
print(url_get.encoding)
print(type(json_data))
# Parse json
print(json_data["current_user_url"])
Output:
utf-8 <class 'dict'> https://api.github.com/user
Error:
TypeError : string indices must be integers
That's a common error message because in a larger json usually also a get back list in the dictionary.
So it normal to parse like this.
json_data['something'][0]['CL_NOME']
Reply


Messages In This Thread
Error string indice must integers Json - by ALEGON - Jan-10-2018, 10:11 AM
RE: Error string indice must integers Json - by mpd - Jan-10-2018, 02:38 PM
RE: Error string indice must integers Json - by snippsat - Jan-10-2018, 03:26 PM
RE: Error string indice must integers Json - by mpd - Jan-10-2018, 05:14 PM
RE: Error string indice must integers Json - by mpd - Jan-10-2018, 06:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  json loads throwing error mpsameer 8 869 Jan-23-2024, 07:04 AM
Last Post: deanhystad
  boto3 - Error - TypeError: string indices must be integers kpatil 7 1,468 Jun-09-2023, 06:56 PM
Last Post: kpatil
  [split] Parse Nested JSON String in Python mmm07 4 1,658 Mar-28-2023, 06:07 PM
Last Post: snippsat
  Response.json list indices must be integers or slices, not str [SOLVED] AlphaInc 4 6,725 Mar-24-2023, 08:34 AM
Last Post: fullytotal
  json decoding error deneme2 10 4,089 Mar-22-2023, 10:44 PM
Last Post: deanhystad
  "TypeError: string indices must be integers, not 'str'" while not using any indices bul1t 2 2,196 Feb-11-2023, 07:03 PM
Last Post: deanhystad
  Error "list indices must be integers or slices, not str" dee 2 1,592 Dec-30-2022, 05:38 PM
Last Post: dee
  python requests library .JSON() error mHosseinDS86 6 3,730 Dec-19-2022, 08:28 PM
Last Post: deanhystad
  Read nested data from JSON - Getting an error marlonbown 5 1,513 Nov-23-2022, 03:51 PM
Last Post: snippsat
  TypeError: string indices must be integers JonWayn 12 3,690 Aug-31-2022, 03:29 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020