[APP][Pro] JSON Handler and Manipulator

Hi,

What I’m trying to do is to make a framework to send commands using JSON and Advance trigger to control my Eufy cameras. The JSON are not sent to the cameras, I using them only in my flows.

I have no experiences with JSON and I’m struggling to understand how I should do to make an array of objects using the Build JSON card. Any tips how I could accomplish that?

Se an example below how I think the JSON could look like if i want to sent several “commands”
at ones in an array and how I try to build the JSON.

image

{
	"type": "AdvancedTrigger",
	"trigger": "EUFYKÖKET",
	"source": "eufy_köket_away",
	"commands": [
		{
			"type": "SECURITYMODE",
			"name": "AWAY",
			"force": true
		},
		{
			"type": "SETTINGS",
			"name": "MOTIONTRACKING",
			"value": true
		},
		{
			"type": "SETTINGS",
			"name": "NIGHTVISION",
			"value": true
		}
	]
}

You can place the whole array in the json value of the card.
So, the complete [...]

Hi

I have a problem, i get a lot of \ in my json

I create a jason


and get the output

And then i put that json in another json

and get a bunch of
how do i get rid of those?

the backslashes isnt in the json-variable in the card


only in the result

/Rikard

does maybe @Arie_J_Godschalk have any ide how to get rid off the \ in the json?

@janrikard
I am unsure what you are trying todo.
You already get a JSON, but then tou create a new empty json (with the flowcard), set a property (from which the name comes from a tag) with the first json, as text?

Are you trying to modify or read the properties?
In both cases (both different flowcards), place the json tag in the Existing Json field.

Hi

Im trying to construct a json like this

{
    "Fri": {
        "date": "2025-01-24",
        "predicted_production": 24,
        "produced_production": 24
    },
    "Sat": {
        "date": "2025-01-25",
        "predicted_production": 25,
        "produced_production": 25
    },
    "Sun": {
        "date": "2025-01-26",
        "predicted_production": 26,
        "produced_production": 0
    },
    "Mon": {
        "date": "2025-01-27",
        "predicted_production": 5,
        "produced_production": 0
    }
}

And i never successed doing that in one step first i construct the with one flowcard

{
        "date": "2025-01-24",
        "predicted_production": 24,
        "produced_production": 24
    }

and then trys to add that to a new json with a second flowcard

 "Fri": {
$json
}

hope this make it more clear

/Rikard

Okay, what you wanna do is:


Here i create a JSON.

Then use this card:

And use it like this:

Doesnt understand what i do wrong

first flowcard

second flowcard

Ive oalso tested without variables in the first flowcard, still gets the
/Rikard

Thats not the right flowcard.
There are flowcards to build json’s with text, numbers and yes/no’s.
And there is another flowcard to build a json with properties filled with a json as value. Thats the one you need. Please check my last post for the specific flowcard that your need.

1 Like

Thank you very much.
With the right flowcard it works perfectly

/Rikard

1 Like