JSON with random number of values

Hello,
I created a website with a Json with 0 result or 1, 2 or 3 value. I found a solution if I have 1 value, but how can I do if 2 or 3 different values like that :

[{"name":"name1","price1":4,"price2":3.09},{"name":"name2","price1":29,"price2":28.5}]

or sometime just one or zero :

[{"name":"name1","price1":4,"price2":3.09}]

When I use this sensor, HA found just one of two :

  - platform: rest
    resource: https://xxx.com/ha.php
    name: website_json
    scan_interval: 30
    json_attributes:
      - price1
      - price2
    value_template: '{{ value_json.name }}'

Thanks a lot for your help

Consider that you are working with a list and not just a map.
See a code example in another project I made: