v16 parse json
#1
Hi all,
json code: from link https://inet-publicapi.mw.elion.ee/dtv-a...minutv-web

Code:
[{"version":"2.0","data":{"context_objects":{"playables":{"channel_1":{"id":"channel_1","commercial_free":false,"consumed":null,"min_pos":0,"max_pos":null,"object_id":1,"object_type":"channel","start_pos":0,"streams":[{"audio_tracks":[{"type":"audio","language":"est","format":null,"pid":null,"source":null},{"type":"audio","language":"nld","format":null,"pid":811,"source":null}],"bitrate":null,"duration":null,"sources":["http://hls-streamer-1-2.minutv.ee/7edb718421e48c9d7104b5080c80970a_1457087825web/input/ch01/index.m3u8","http://hls-streamer-1-1.minutv.ee/7edb718421e48c9d7104b5080c80970a_1457087825web/input/ch01/index.m3u8"],"text_tracks":[],"type":"hls","valid_until":"2016-03-04T12:37:05+02:00","video_tracks":[{"resolution_type":"sd"}],"uiName":null}],"stream_type":"continuous"}},"channels":{"1":{"features":{"net_recordable":true,"catchup":true},"icons":[{"type":"h40pxw90px","url":"h40pxw90px/1.png","md5":"3ea047acbaca857d9bef3af7e2280d80"},{"type":"90x40","url":"90x40/1.png","md5":"3ea047acbaca857d9bef3af7e2280d80"},{"type":"72x49","url":"72x49/1.jpg","md5":"31fd5c0b0f7021fefb3ce19d972047c6"},{"type":"87x46","url":"87x46/1.png","md5":"bf920bb81e8123b513be561c3e10222c"},{"type":"90x40_white","url":"90x40_white/1.png","md5":"fd8e7c0cbdc7c98329e505922e702551"}],"id":1,"packet_ids":[1,12,13,14,15,30,34,35,36,38,44,46,129,130,162,163,166,167,181,182,190,191,224,225,233],"streams":[{"audio_tracks":[{"type":"audio","language":"est","format":null,"pid":null,"source":null},{"type":"audio","language":"nld","format":null,"pid":811,"source":null}],"bitrate":null,"duration":null,"sources":[],"text_tracks":[{"type":"subtitles","language":"est"},{"type":"subtitles","language":"rus"},{"type":"subtitles","language":"ned"}],"type":"multicast","valid_until":null,"video_tracks":[{"resolution_type":"hd"}],"uiName":null},{"audio_tracks":[{"type":"audio","language":"est","format":null,"pid":null,"source":null},{"type":"audio","language":"nld","format":null,"pid":811,"source":null}],"bitrate":null,"duration":null,"sources":[],"text_tracks":[{"type":"subtitles","language":"est"},{"type":"subtitles","language":"rus"},{"type":"subtitles","language":"ned"}],"type":"multicast","valid_until":null,"video_tracks":[{"resolution_type":"sd"}],"uiName":null},{"audio_tracks":[{"type":"audio","language":"est","format":null,"pid":null,"source":null},{"type":"audio","language":"nld","format":null,"pid":811,"source":null}],"bitrate":null,"duration":null,"sources":["http://hls-streamer-1-2.minutv.ee/7edb718421e48c9d7104b5080c80970a_1457087825web/input/ch01/index.m3u8","http://hls-streamer-1-1.minutv.ee/7edb718421e48c9d7104b5080c80970a_1457087825web/input/ch01/index.m3u8"],"text_tracks":[],"type":"hls","valid_until":"2016-03-04T12:37:05+02:00","video_tracks":[{"resolution_type":"sd"}],"uiName":null},{"audio_tracks":[{"type":"audio","language":"est","format":null,"pid":null,"source":null},{"type":"audio","language":"nld","format":null,"pid":811,"source":null}],"bitrate":null,"duration":null,"sources":[],"text_tracks":[],"type":"multicast","valid_until":null,"video_tracks":[{"resolution_type":"pip"}],"uiName":null}],"title":"ETV"}}},"playable_id":"channel_1","channel_id":1},"error_code":null,"handler":"channel.start_playing","message":null,"message_type":null,"success":true}]

pls help me to parse json to kodi items = list()
where should i start to get "title" and "source" key to list?

Br,
Andris
Reply
#2
Hello andrisaedma, in order to parse json data you need to import json and then use function loads to be able to get what you want:

import json
jsonData = json.loads("JSON AS STRING")
jsonData[Key]
Reply
#3
yes, I figured it out,
thank you for the response.

i get very good starting point also here:
https://pythonspot.com/json-encoding-and...th-python/

--Andris
Reply

Logout Mark Read Team Forum Stats Members Help
parse json0