REST JSON return the number of elements

Blockquote

Preformatted textHi all,
I am trying to get the number of elements returned in a JSON body. I have tried many things but the template below is currently what I have working.

Example Data

{"room":"Games Room","devices":[{"id":"apple:1005:9-24","disc":"0718cb843a","idType":150,"rssi@1m":-65,"rssi":-84,"raw":3.49,"distance":3.28,"speed":0.03,"mac":"6d3324df80ac","interval":757},{"id":"sd:0xfe9f","idType":15,"rssi@1m":-71,"rssi":-83,"raw":2.20,"distance":1.91,"speed":0.01,"mac":"6fed8cf88ca9","interval":954},{"id":"1a4df37895fb","idType":1,"rssi@1m":-65,"rssi":-91,"raw":5.53,"distance":4.34,"speed":0.07,"mac":"1a4df37895fb","interval":2979},{"id":"PM_iPhone","disc":"3f1e5fcff06b","idType":250,"rssi@1m":-65,"rssi":-89,"raw":4.85,"distance":4.41,"speed":0.03,"mac":"7938608d2c1f","interval":810},{"id":"apple:1006:10-12","disc":"081ed88c6808","idType":150,"rssi@1m":-65,"rssi":-89,"raw":4.85,"distance":3.96,"speed":-0.03,"mac":"692c71d0ec01","interval":882},{"id":"e52de6018426","idType":1,"rssi@1m":-65,"rssi":-85,"raw":3.73,"distance":4.44,"speed":0.00,"mac":"e52de6018426","interval":8961},{"id":"e897946f12b7","idType":1,"rssi@1m":-65,"rssi":-89,"raw":4.85,"distance":4.51,"speed":0.01,"mac":"e897946f12b7","interval":8754},{"id":"e9f9bfcd44ba","idType":1,"rssi@1m":-65,"rssi":-89,"raw":4.85,"distance":4.36,"speed":0.03,"mac":"e9f9bfcd44ba","interval":5977}]}

Working Configuratyion from sensor.yaml without an attribute to tell me the number of elements, that the bit I am missing.

  - platform: rest
    name: GR_ESP
    resource: http://192.168.0.74/json/devices
    method: GET
    scan_interval: 60
    value_template: 'OK'
    json_attributes:
    - room
    - devices

Can someone please point me the correct direction?

Thanks
Paul

Assunming you mean #devices add/use

value_template: "{{ value_json.devices | count }}"

BTW…you cannot use this in the attributes

And another one!

You seem to have a habit to create topics, ask for help but you lack the decency to react to any effort to help you, let alone show your gratitude and just stay silent even though you are active on the forum!?
Some character but in the end: just as in real life you encounter them everywhere…