i have a Json Data that i can access from my own api
But the Json Data is not in a .json file its in Php file (like in the link below)
now i want to use Python to print the Data
import json
from urllib.request import urlopen
with urlopen("https://**********.000webhostapp.com/api/value/read_all.php") as response:
source = response.read()
data = source
for item in data['value']['temp']:
print(item)
This the python Script i use
this is the main Error :
for item in data['value']['temp']:
TypeError: byte indices must be integers or slices, not str
The JSON looks like:
{"value":[{"id":"1","temp":"25.60","water":"80%","total":"5L","percent":"50%"}...
jsonlibrary in your code