# JSON help

**URL:** <https://community.homey.app/t/json-help/91355>\
**Category:** Questions & Help\
**Created:** [October 9, 2023, 12:05pm UTC](https://community.homey.app/t/json-help/91355 "2023-10-09T12:05:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![TKroon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tkroon/32/9504_2.png) [@TKroon](https://community.homey.app/u/TKroon)\
**Post date:** [October 9, 2023, 12:05pm UTC](https://community.homey.app/t/json-help/91355/1 "2023-10-09T12:05:16Z")

</div>

Again I’m stuck parsing a JSON (displayed below). Any path I try, results in an error. The result I’m trying to achieve is result 1 or 2.

Bonus: it would be very nice if I wouldn’t have to enter the date in the path, but rather result number 1 or 2. So I can simply get the data each morning, and now result 1 is today, and result 2 is tomorrow.

Thank you for your help!

```auto
{
  "result": {
    "2023-10-08": 593,
    "2023-10-09": 319
  },
  "message": {
    "code": 0,
    "type": "success",
    "text": "",
    "pid": "iH4eaaaa",
    "info": {
      "latitude": 51.0000,
      "longitude": 5.0000,
      "distance": 0,
      "place": "<knip>, Netherlands",
      "timezone": "Europe/Amsterdam",
      "time": "2023-10-08T00:02:51+02:00",
      "time_utc": "2023-10-07T22:02:51+00:00"
    },
    "ratelimit": {
      "period": 3600,
      "limit": 12,
      "remaining": 11
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![OH2TH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/oh2th/32/111414_2.png) [@OH2TH](https://community.homey.app/u/OH2TH)\
**Post date:** [October 9, 2023, 12:31pm UTC](https://community.homey.app/t/json-help/91355/2 "2023-10-09T12:31:20Z")

</div>

JSONpath `$.result.*` should return a list of the values:

```auto
[
  593,
  319
]

```

Then you can continue to get either the first or second value with `$.0` or `$.1`.

To my understanding, there is no direct path to get the value, but as above, it is a two step thing.

Somwith advanced flows, you need to JSON parser cards.

---

<div class="post-metadata">

**Author:** ![TKroon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tkroon/32/9504_2.png) [@TKroon](https://community.homey.app/u/TKroon)\
**Post date:** [October 9, 2023, 5:49pm UTC](https://community.homey.app/t/json-help/91355/3 "2023-10-09T17:49:02Z")

</div>

Thank you for your reply. When adding the THEN-card with (translated from Dutch):

"Read \< answer \> as JSON and select pad $.result.\* as text-tag

Results in error:

Lexical error on line 1. Unrecognized text.  
$. $.result.\*  
–^

Any suggestions?

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 9, 2023, 7:08pm UTC](https://community.homey.app/t/json-help/91355/4 "2023-10-09T19:08:25Z")

</div>

You probably shouldn’t use this trailing `.*` after ‘result’ I guess.  
I use this (it returns the contents of ‘liveweer’)

 ![Screenshot from 2023-10-09 20-54-15](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/b/0b19800ab48df1c38e4fed283fa73284fafc999f.png)

---

<div class="post-metadata">

**Author:** ![TKroon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tkroon/32/9504_2.png) [@TKroon](https://community.homey.app/u/TKroon)\
**Post date:** [October 9, 2023, 7:30pm UTC](https://community.homey.app/t/json-help/91355/5 "2023-10-09T19:30:33Z")

</div>

Unfortunately still the same error:

 ![Scherm­afbeelding 2023-10-09 om 21.30.11](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/2/d209060377c8089a7bc0c4f0b2eac2192d7b842e.png)

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 9, 2023, 8:12pm UTC](https://community.homey.app/t/json-help/91355/6 "2023-10-09T20:12:15Z")

</div>

Hmmmm, when I feed your JSON to the parse card, it works. I always compare the original http get result as well when things aren’t going as expected.

 ![Screenshot from 2023-10-09 22-10-15](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/8/78feda520ec6545dc8fb7a3cc98b6da4839ef6e5.png)

> ![Screenshot from 2023-10-09 22-08-10](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/5/d5fb281e0c28b975bed613c85e9222ed2522a437.png)

**Oh, and I learned something new**  
The path `$.result.*` returns the values only, omitting the dates 😉 @OH2TH was totally right

> ![Screenshot from 2023-10-09 22-13-45](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/7/57073c6a6a2c3f054e37d9551f1fa22d052dbb21.png)

---

<div class="post-metadata">

**Author:** ![TKroon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tkroon/32/9504_2.png) [@TKroon](https://community.homey.app/u/TKroon)\
**Post date:** [October 10, 2023, 1:01pm UTC](https://community.homey.app/t/json-help/91355/7 "2023-10-10T13:01:27Z")

</div>

Then I’m certain I’m doing something wrong. I’ve copied all your cards @Peter_Kawa, but I still get the same error.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 10, 2023, 5:14pm UTC](https://community.homey.app/t/json-help/91355/8 "2023-10-10T17:14:53Z")

</div>

Are you sure there’s no hidden leading / trailing whitespace, in the $.result… line?

---

<div class="post-metadata">

**Author:** ![TKroon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tkroon/32/9504_2.png) [@TKroon](https://community.homey.app/u/TKroon)\
**Post date:** [October 10, 2023, 5:51pm UTC](https://community.homey.app/t/json-help/91355/9 "2023-10-10T17:51:30Z")

</div>

Thank you… 🙈
