How to build json from data type

Hi
I have a data type “marker”
under marker i have some fields: “x”, “y”. “include”, related_to_company" and more
I have an action that i am adding markers to the data base with this information.
when ever i am creating or updating marker information, i would like to also to update a custom state “marker_json” type text.

in the end, i would like that “marker_json” will include only the x,y, and include infromation on the following format:

[ { “x”: 100, “y”: 150, “include”: true }, { “x”: 200, “y”: 250, “include”: false }, { “x”: 600, “y”: 150, “include”: true } ]

how can i do that?
i tried to do something like this in order to create the json from the list but it’s not working
image

THANKS!!

In the :format as text you can build your JSON.

For example:
{“name”: “This Marker’s Name”, “phone”: “This Marker’s Phone”}
Delimiter:,
Split by ,

The usage of :formatted as JSON-safe is not necessary in this case as it puts “” around the example. I recommend you to read the doc for “:formatted as JSON-safe” for a better understanding of it’s use cases.

THANK YOU!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.