# \[APP\]\[Pro\] JSON Handler and Manipulator

**URL:** <https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317>\
**Category:** Apps\
**Tags:** app, tools, homey-pro\
**Created:** [July 21, 2022, 9:01am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317 "2022-07-21T09:01:57Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![Nigel\_Scott](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/nigel_scott/32/10602_2.png) [@Nigel\_Scott](https://community.homey.app/u/Nigel_Scott)\
**Post date:** [January 24, 2023, 12:23pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/41 "2023-01-24T12:23:36Z")

</div>

Also having this issue - may be to do with the JSON needing parsing, but I’m not sure and can’t get the Parse JSON card to work at all. ☹

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [January 26, 2023, 6:35pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/42 "2023-01-26T18:35:37Z")

</div>

Hey, could you share the json it parses?

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [January 26, 2023, 6:35pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/43 "2023-01-26T18:35:58Z")

</div>

Please share the json and flow?

---

<div class="post-metadata">

**Author:** ![Hamster](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hamster/32/16580_2.png) [@Hamster](https://community.homey.app/u/Hamster)\
**Post date:** [January 26, 2023, 6:46pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/44 "2023-01-26T18:46:38Z")

</div>

The source is in my post. It’s a very large json 🙂

---

<div class="post-metadata">

**Author:** ![Nigel\_Scott](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/nigel_scott/32/10602_2.png) [@Nigel\_Scott](https://community.homey.app/u/Nigel_Scott)\
**Post date:** [January 26, 2023, 6:47pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/45 "2023-01-26T18:47:22Z")

</div>

I managed to resolve, thanks Arie

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [January 26, 2023, 7:11pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/46 "2023-01-26T19:11:11Z")

</div>

Well, first of all, you do not need to use the `$` symbol, since the json is the starting point.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/c/cc720fec50f985504a65ec59393b4f090b4678b8.png)

But, it will still not work, i think the jsonfile is to big for the Logic HTTP Get?  
Because, i cannot place the answer/value in a variable or a BetterLogic variable.

The left side of my picture doesn’t work at all!

However, when you use the right app side, it does work.

Also, this works fine:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/5/657341fb66644df86ae8e4ccf891d429d0c54f97.png)

Meaning: It’s a “bug” in the default Logic Http Get card.

---

<div class="post-metadata">

**Author:** ![B3rt](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/b3rt/32/9435_2.png) [@B3rt](https://community.homey.app/u/B3rt)\
**Post date:** [January 31, 2023, 11:55am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/47 "2023-01-31T11:55:04Z")

</div>

Hi,

I need some help, don’t know if this is possible.  
I do an http request to a server, this server answers with the following response:  
{“result”:“false”,“msg”:“TV poort reageert niet”}

Is it possible to use this app to convert this string into tags?  
So i use the "lees json’’ card, in the ‘bestaande json’ i put the answer tag of the http request card which contains this string.  
Then i am not sure what to fill in to get the response into tag cards…  
I just need actually 2 cards: result and msg

Any advise?

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [January 31, 2023, 12:09pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/48 "2023-01-31T12:09:54Z")

</div>

Sure, use the 3xRead flowcard.  
Use the json as input.  
In the first text1-field enter result.  
In the text2 field, enter msg.

Now 2 (of the 3) text tokens will be filled with the values.

---

<div class="post-metadata">

**Author:** ![B3rt](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/b3rt/32/9435_2.png) [@B3rt](https://community.homey.app/u/B3rt)\
**Post date:** [January 31, 2023, 12:45pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/49 "2023-01-31T12:45:09Z")

</div>

thx got it working!

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [February 17, 2023, 2:15pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/50 "2023-02-17T14:15:47Z")

</div>

I have changed the way paths work (everythink will keep working).  
It now uses the npm jsonpath library:

> **[GitHub - dchester/jsonpath: Query and manipulate JavaScript objects with...](https://github.com/dchester/jsonpath#readme)**
>
> Query and manipulate JavaScript objects with JSONPath expressions. Robust JSONPath engine for Node.js. - GitHub - dchester/jsonpath: Query and manipulate JavaScript objects with JSONPath expressio...

The `$.` is added automaticly when you do not, so you can still query directly by calling it’s property like `text`, no need to write `$.text`.

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [February 17, 2023, 2:42pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/51 "2023-02-17T14:42:01Z")

</div>

This will allow for:  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/5/45d24592a033c99826c2574dabd6a654e6a69d0a.png)

Here, a json with an array of flows returned from the DC app.  
The JSON handler app searches for the first flow with a name that starts with ‘Con’ and returns it’s name.

---

<div class="post-metadata">

**Author:** ![Icepick](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/icepick/32/56463_2.png) [@Icepick](https://community.homey.app/u/Icepick)\
**Post date:** [July 1, 2023, 5:36am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/52 "2023-07-01T05:36:09Z")

</div>

I have been using JQ on linux for a number of years and I want to convert some of these scripts to my homey. I am running into syntax issues… and this one I can’t figure it out;

 ![Screenshot 2023-07-01 at 07.32.44](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/5/e53358d4c218c0c8e69a6f425e3afd98587b0a02.jpeg)

```auto
.parcellifecycleResponse.parcelLifeCycleData.scanInfo.scan | .[-1] | .scanData.location

```

I am sure I am missing something simple here… but what am I doing wrong? The statement works in JQ and it would return me the location of my DPD parcel.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [July 1, 2023, 5:41am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/53 "2023-07-01T05:41:16Z")

</div>

JSONPath != jq

---

<div class="post-metadata">

**Author:** ![Icepick](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/icepick/32/56463_2.png) [@Icepick](https://community.homey.app/u/Icepick)\
**Post date:** [July 1, 2023, 5:54am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/54 "2023-07-01T05:54:30Z")

</div>

yeah I know… doesn’t help me unfortunately…

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [July 1, 2023, 5:55am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/55 "2023-07-01T05:55:40Z")

</div>

Please share the json so i can gove you the path for it 😉

---

<div class="post-metadata">

**Author:** ![Icepick](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/icepick/32/56463_2.png) [@Icepick](https://community.homey.app/u/Icepick)\
**Post date:** [July 1, 2023, 5:57am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/56 "2023-07-01T05:57:24Z")

</div>

This is the Json;  
[https://tracking.dpd.de/rest/plc/en\_NL/23715012122295](https://tracking.dpd.de/rest/plc/en_NL/23715012122295)

I kind of got it to work with the regular logic cards but I think your app would be more suited for it!

 ![Screenshot 2023-07-01 at 07.57.38](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/7/f72100a1f0d4f4918baea65b8fec048759279146.jpeg)

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [July 1, 2023, 5:58am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/57 "2023-07-01T05:58:30Z")

</div>

First of, removing the leading dots.  
Try this?

`parcellifecycleResponse.parcelLifeCycleData.scanInfo.scan[0]`

---

<div class="post-metadata">

**Author:** ![Icepick](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/icepick/32/56463_2.png) [@Icepick](https://community.homey.app/u/Icepick)\
**Post date:** [July 1, 2023, 6:06am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/58 "2023-07-01T06:06:13Z")

</div>

> [@Arie\_J\_Godschalk](#):
>
> parcellifecycleResponse.parcelLifeCycleData.scanInfo.scan[0]

It throws me;

> `Invalid token type: text1. Expected: String`

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [July 1, 2023, 6:11am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/59 "2023-07-01T06:11:34Z")

</div>

> [@Arie\_J\_Godschalk](#):
>
> parcellifecycleResponse.parcelLifeCycleData.scanInfo.scan[0]

`parcellifecycleResponse.parcelLifeCycleData.scanInfo.scan[0].scanData.location`  
and  
`parcellifecycleResponse.parcelLifeCycleData.scanInfo.scan[0].scanData.name`

This works for me.

---

<div class="post-metadata">

**Author:** ![Icepick](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/icepick/32/56463_2.png) [@Icepick](https://community.homey.app/u/Icepick)\
**Post date:** [July 1, 2023, 10:30am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/60 "2023-07-01T10:30:54Z")

</div>

> [@Arie\_J\_Godschalk](#):
>
> parcellifecycleResponse.parcelLifeCycleData.scanInfo.scan[0].scanData.location

Yes this works for me as well now. I made a minor change to get the latest status (this wasn’t in the original example);

> parcellifecycleResponse.parcelLifeCycleData.scanInfo.scan[-1:].scanData.location

What confused me a little is that with the regular logic cards the output can be still json (like the whole array)… I noticed with your json handler it’s the actual field that needs to be the output (at least it seems that way).

[Previous page](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317.md?page=2)

[Next page](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317.md?page=4)
