i'm trying to pull [dict get $data watched show title] from the data below after using json2dict. what am I missing to pull the watched data via dict or is there a better way?
Looking at the json-data shows that the watched-element contains a tcl-list, not a dict. Considder using something along these lines (assuming $source contains the json-source)
[{"id":2020512,"name":"Romper"},{"id":5882783,"name":"Romper amante"},{"id":5630419,"name":"Romper the last"},{"id":5630428,"name":"Romper the Last II"},{"id":5465877,"name":"Romper5"}]
[dict get $json_data id] seems to not working, any help regarding that?
@elbandido:
First off, did you convert your json-data to a tcl-list/dict collection using the json::json2dict command?
Secondly, your set of data will return a list of dicts, so you'll either have to iterate through each of them using foreach, or select a specific index using lindex before using dict to get the id property.
As I said in my previous post, the json-data you posted will translate to a list of dicts... Use lindex or foreach to extract the dict(s) from the list before using the dict-command on it/them.