Hi I’m having issues order the json data into something more readable.
What I’m looking for is a top 10 of keys with the belonging impressions put together. The rest (clicks, crt and position can be ignored or filtered-out somehow)
any advice is appreciated.
the rest sensor has an output like:
rows:
- keys:
- mysite
clicks: 0
impressions: 1
ctr: 0
position: 80
- keys:
- my beautiful site
clicks: 0
impressions: 1
ctr: 0
position: 26
when I execute this in the template tester it gives me an error
{{ state_attr('sensor.google_api', 'rows')
| sort(reverse=true, attribute='impressions') | map(attribute='keys','impressions') | list }}
Output:
TemplateSyntaxError: invalid syntax for function call expression
When I execute this, it gives me only the “keys” but not the belonging impressions:
{{ state_attr('sensor.google_api', 'rows')
| sort(reverse=true, attribute='impressions') | map(attribute='keys') | list }}
output:
[
[
"mysite"
],
[
"my beautiful site"
],
What I’m looking for is an output like, so without the brackets:
"mysite"
"23",
"my beautiful site"
"54"
etc