# \[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:** 1

<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 21, 2022, 9:01am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/1 "2022-07-21T09:01:57Z")

</div>

Live in Store now!

> **[JSON Handler | Homey](https://homey.app/en-us/app/nl.qluster-it.JsonHandler/JSON-Handler/)**
>
> JSON handler and manipulator

Lightweight app for creating, manipulating and retrieving JSON objects.

You can alter a existing JSON object, or one will be created.  
No need to pre-define the structure.

You can, for example, use the output JSON token as HomeyScript argument, and use JSON.parse(args[0]) to read the object you created.

## Creating and Manipulating JSON.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/4/b48117fec8a9e4774962f090de8a8fa4834126e2.png)  
  
  
Output from the bottom left two cards:

```auto
{
    "main5": true, // or "main10": true,
    "1arg": {
        "test1": true,
        "light": {
            "text": "Test1"
        },
        "Intend": 8,
        "Bool": true
    },
    "3args": {
        "test3": true,
        "light": {
            "text": "Test3"
        },
        "Intend": 8,
        "Bool": true
    },
    "5args": {
        "test5": true,
        "light": {
            "text": "Test5"
        },
        "Intend": 8,
        "Bool": true
    },
    "10args": {
        "test10": true,
        "light": {
            "text": "Test10"
        },
        "Intend": 8,
        "Bool": true
    }
}

```

## Reading JSON.

Reading the above generated JSON.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/9/59b144ac2b5ec89b22a02f29dab11965fa37b9d6.png)  
 →   
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/1/312234a5d8e132870c3a89854874ca53439ff674.png)

## Loop cards

Essentially, i created a `loop` card, or `for each`

```auto
for (var (item,key,index) in Collection) {
}

```

It works pretty easy, you need two cards:

- A When/Trigger Card, which will be triggered for each item in the collection, with these tokens:
  - Item as Text
  - Item as Number
  - Item as Yes/No
  - Key
  - Index
  - Text 1 (argument)

- And a Then/Action Card, which you supply with an (json) collection (array or obj) and an optional argument.  
The When card will be execute for each item in the collection, with the supplied tokens.

### Example

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

The bottom card will execute the above (Trigger/When) card three times.  
Result:  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/f/cf1fac5592f2e1bf2d0debed06e616bcf84856b8.png)

Here is another example:

> [@\[APP\]\[Pro\] FTP Client - Control FTP Servers through a directory-based UI in the Homey App or Web App](https://community.homey.app/t/app-pro-ftp-client-control-ftp-servers-through-a-directory-based-ui-in-the-homey-app-or-web-app/70876/62):
>
> Okay, next up: Flowcard: You can retrieve all files from a folder as JSON Array/Collection. Flowcard: Get a Image Token from path. This one is actually the same flowcard as Get Image Token from dropdown, i added a optional sub-path to it). What can you do with it (not write yet, that’s next @B3rt wink ) : You can Loop through all files in a folder and do something with the images, like send them to your phone, or (maybe later) save them on an external FTP somewhere. You can also loop thro…

### Please report **issues** or **feature** requests at [Issues · Qluster-IT/nl.qluster-it.JsonHandler · GitHub](https://github.com/Qluster-IT/nl.qluster-it.JsonHandler/issues).

### Apps:

> [@\[Profile\] Arie J. Godschalk](https://community.homey.app/t/profile-arie-j-godschalk/70663/2):
>
> Apps developed or maintained by me: [Advanced Triggers](https://community.homey.app/t/app-pro-advanced-triggers-trigger-and-action-cards-with-eventname-for-advanced-flows/65651) , [BeNext](https://community.homey.app/t/app-pro-benext-benext-devices-for-homey/76104) , [Better Logic](https://community.homey.app/t/app-pro-better-logic-just-some-better-logic-and-variable-management/5568) , [Chronograph](https://community.homey.app/t/app-pro-chronograph-adds-precise-timer-stopwatch-and-transition-functionality-to-homey/18214) , [Device Capabilities](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287) , [Advanced Virtual Device](https://community.homey.app/t/app-pro-advanced-virtual-device-device-capabilities-app-with-unique-text-status-indicator/68198) , [FTP Client](https://community.homey.app/t/app-pro-ftp-client/70876) , [Google Services](https://community.homey.app/t/google-services-app-for-translate-and-new-text-to-speech-for-any-device-with-url-input/43257) , [Homesh Controller](https://community.homey.app/t/app-pro-homesh-controller-homesh-satellite-connect-homey-pro-2023-to-homey-pro-for-led-speaker-zwave-satellite-and-network-resource/70369) , [Homesh Satellite](https://community.homey.app/t/app-pro-homesh-controller-homesh-satellite-connect-homey-pro-2023-to-homey-pro-for-led-speaker-zwave-satellite-and-network-resource/70369) , [JSON Handler and Manipulator](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317) , [LOQED](https://community.homey.app/t/app-pro-loqed-your-personal-doorman/89816) , [Music Url Converter](https://community.homey.app/t/music-url-converter-play-music-urls-on-homey-bigger-then-900-kb/43546) , [Reverse Proxy and DDNS](https://community.homey.app/t/app-pro-reverse-proxy-and-ddns/160862) , [Simple Log](https://community.homey.app/t/simple-log-app/146) , [Universal Media Player](https://community.homey.app/t/universal-media-player-a-generic-storages-place-for-your-homey-speakers-tvs-or-other-media-devices/43450) and [Virtual Devices](https://community.homey.app/t/app-pro-virtual-devices-virtual-devices-to-simulate-1-or-more-real-devices/1723) . [Goto profi…](https://community.homey.app/t/profile-arie-j-godschalk/70663)

### Donations or Sponsorship

> [@\[Profile\] Arie J. Godschalk](https://community.homey.app/t/profile-arie-j-godschalk/70663/3):
>
> Donations or Sponsorship. You can help with the development, maintenance and support for the Apps, by donating or becoming a sponsor. This would be much appreciated! The more donations i receive, the more time i can make free for development and support. slight_smileDonations can be done through: [[PP] PayPal](https://paypal.me/QlusterIT) Requires a PayPal account. [[GS] Github Sponsors](https://github.com/sponsors/XeroxQ) Allowes for CreditCard. Sponsorships can be done through: [[P] Patreon](https://www.patreon.com/QlusterIT/membership) Requires a Patreon account. [[GS] Github Sponsors](https://github.com/sponsors/XeroxQ) …

---

<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 21, 2022, 9:15am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/2 "2022-07-21T09:15:37Z")

</div>

Reserved

---

<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 21, 2022, 9:15am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/3 "2022-07-21T09:15:44Z")

</div>

Reserved 2

---

<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 21, 2022, 9:15am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/4 "2022-07-21T09:15:51Z")

</div>

Reserved 3

---

<div class="post-metadata">

**Author:** ![Jero](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jero/32/17556_2.png) [@Jero](https://community.homey.app/u/Jero)\
**Post date:** [July 21, 2022, 10:20am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/5 "2022-07-21T10:20:16Z")

</div>

Why not use the built in cards. Abusing arguments like this make things very ugly.

---

<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 21, 2022, 10:21am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/6 "2022-07-21T10:21:13Z")

</div>

Because that means many cards.  
This way flows can have way less cards when interacting with e.g. HomeyScript!

Also, when using Read JSON, you will get all the same TAG’s.  
With JSON Handler Retrieve cards, you get different Tagnames; which makes it more readable i.m.h.o.

---

<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 21, 2022, 1:26pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/7 "2022-07-21T13:26:08Z")

</div>

And, as you perhaps have noticed allready, people allready are using different methods instead of the default JSON editors, because it creates to many cards: [HomeyScript: Any sane ways to use args? - Questions & Help - Homey Community Forum](https://community.homey.app/t/homeyscript-any-sane-ways-to-use-args/66178/5)

---

<div class="post-metadata">

**Author:** ![Jero](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jero/32/17556_2.png) [@Jero](https://community.homey.app/u/Jero)\
**Post date:** [July 21, 2022, 2:22pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/8 "2022-07-21T14:22:59Z")

</div>

I’m not sure how that is related to this? You would still need to do JSON.parse(args[0]) in your script. Since Homey does not really have a JSON type token.

---

<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 21, 2022, 3:57pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/9 "2022-07-21T15:57:52Z")

</div>

Yes, ofc, indeed you need to parse the json in HS.

But with this app you don’t need to manually parse it (and remember the double quotes for strings) like this:

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

Also you dont need to customly define the JSON and than add all properties through multiple cards like this:

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

Now you just need:

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

---

<div class="post-metadata">

**Author:** ![Marcel\_Ubels](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_ubels/32/18860_2.png) [@Marcel\_Ubels](https://community.homey.app/u/Marcel_Ubels)\
**Post date:** [July 21, 2022, 4:23pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/10 "2022-07-21T16:23:59Z")

</div>

Will give it a shot in the future. At this moment i am rewriting all my flows into the advanced flows. I also have many flows involving json. They were a hell of a job, so maybe this is THE app for me. In advance thx for creating this. I hope that my old method with this app is easier, had to make 24 calls collecting data about themperature, humidity, wind, etc etc for every hour. For three collections of data that will be 72 calls. And i have many many other data that i wanted to collect. Just a little example how it now worked

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/f/4f1e958725127ab211bc7b29c667a67ff0617916.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 26, 2022, 5:27pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/11 "2022-07-26T17:27:02Z")

</div>

Version 1.0.4 is live in store now: [https://homey.app/nl-nl/app/nl.qluster-it.JsonHandler/JSON-Handler/](https://homey.app/nl-nl/app/nl.qluster-it.JsonHandler/JSON-Handler/)

---

<div class="post-metadata">

**Author:** ![Anders\_Gregow](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/anders_gregow/32/61721_2.png) [@Anders\_Gregow](https://community.homey.app/u/Anders_Gregow)\
**Post date:** [August 5, 2022, 12:18pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/12 "2022-08-05T12:18:37Z")

</div>

Say you are using the Read JSON card with 3 arguments.  
Can you use only 2 of the arguments?  
Can you use both argument-text1 and argument-number1, or only one of them?

---

<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:** [August 5, 2022, 4:28pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/13 "2022-08-05T16:28:55Z")

</div>

Any way you wanna go.  
Almost all arguments are optional, so you could, if you wish, always use the 3x10 argument card, also if you just start with one text.

The json is also optional: if non is supplied, a json object is created.

Also, properties that are non existing on existing Json’s, are created when filled. So, no need to pre-define the Json structure.

---

<div class="post-metadata">

**Author:** ![jonorland](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jonorland/32/16469_2.png) [@jonorland](https://community.homey.app/u/jonorland)\
**Post date:** [August 9, 2022, 6:56pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/14 "2022-08-09T18:56:17Z")

</div>

Hi,

I hoping this app are what I need but I don’t know if it’s possible and I have a hard time to get started.

I’m using the Asus WRT app connected to my router and from that I get a trigger when some device connects to the router. From the trigger card there are four tags, _name, nickname, IP and MAC_.

What I like to do is to have a database that updates dynamic with connected devices. Is it possible with this app? Any tip to get me started?

Thanks

---

<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:** [August 9, 2022, 7:53pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/15 "2022-08-09T19:53:13Z")

</div>

I think you’ll need a little MySQL server and this app [[APP][PRO] MySQL-Client](https://community.homey.app/t/app-pro-mysql-client/62459)

---

<div class="post-metadata">

**Author:** ![Anders\_Gregow](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/anders_gregow/32/61721_2.png) [@Anders\_Gregow](https://community.homey.app/u/Anders_Gregow)\
**Post date:** [September 18, 2022, 5:35pm UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/16 "2022-09-18T17:35:55Z")

</div>

Would it be possible to have the tag names set dynamically?  
When using the tags in a flow the name “Text1” is better than “result” but still making it cumbersum to remember which tag holds what value.

---

<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:** [September 19, 2022, 7:34am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/17 "2022-09-19T07:34:26Z")

</div>

Hey,

Well i see two possible options:

- Create Global Tags on the fly.  
A flowcard would not have Set Text1 = [input], but more something like Set [name]=[input], where you could fill in the name and a Global Tag would be created.
- A Virtual/Fake Device with customisable property names ( like [AVD](https://community.homey.app/t/advanced-virtual-device-share-your-device/68676)), which you could set through flowcards like the current JSON cards.

But both solutions have one very big weakness: Using the same tag at the same time is gonna create issues, because the scope of the Results are outside of the Flow.  
This can/will cause “random” feeling errors.

This makes any solutions that i currently can see, not very usefull.

---

<div class="post-metadata">

**Author:** ![Anders\_Gregow](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/anders_gregow/32/61721_2.png) [@Anders\_Gregow](https://community.homey.app/u/Anders_Gregow)\
**Post date:** [September 19, 2022, 7:50am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/18 "2022-09-19T07:50:33Z")

</div>

Ok, that doesn’t sound as any good solutions.

---

<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:** [September 19, 2022, 7:53am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/19 "2022-09-19T07:53:49Z")

</div>

When i am done with AVD and [The Flow Exchange(r) - Exchange Your Flows with Others! - Apps - Homey Community Forum](https://community.homey.app/t/the-flow-exchange-r-exchange-your-flows-with-others/68981/3) i might take another look at the possibilities. But thats all i can promise.

---

<div class="post-metadata">

**Author:** ![Anders\_Gregow](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/anders_gregow/32/61721_2.png) [@Anders\_Gregow](https://community.homey.app/u/Anders_Gregow)\
**Post date:** [September 20, 2022, 6:09am UTC](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317/20 "2022-09-20T06:09:26Z")

</div>

So the Homey code requires the tags from an action card must have static result tag(s)?!  
This is why you have different sizes of JSON handler cards.  
I hope this will be changed in upcomming Homey releases.

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