How to use a JSON object from client javascript?

I have a JavaScript function that runs when the page is loaded, it makes an api call to the localhost server on my computer that returns a json object. How would i be able to use this data in repeating groups?

I can output the json text to the page successfully using javascript to bubble plugin. the output is below.

[{"CircuitID":0,"PowerCapacity":1885,"PowerProduction":1575,"PowerConsumed":979.5582885742188,"PowerMaxConsumed":2057.972412109375,"BatteryDifferential":0,"BatteryPercent":0,"BatteryCapacity":0,"BatteryTimeEmpty":"00:00:00","BatteryTimeFull":"00:00:00","FuseTriggered":false},{"CircuitID":1,"PowerCapacity":30,"PowerProduction":0,"PowerConsumed":0,"PowerMaxConsumed":0,"BatteryDifferential":0,"BatteryPercent":0,"BatteryCapacity":0,"BatteryTimeEmpty":"00:00:00","BatteryTimeFull":"00:00:00","FuseTriggered":false}]

This isn’t ideal but it’s the only way I know.

Create an api in the api connector and add a parameter that accepts a text, let’s call it package
Then create a backend workflow let’s call it Harry, with a parameter called package.
In the backend workflow have a single step - return data, return package as a text.

Now back in the api connector put in the url to call Harry. Paste your json as the value for package and hit initialise.

If it’s done right and I probably missed a step then you should see be able to assign the different types to your payload. You can then use it as an action or a datatype anywhere in your app.

1 Like

If you are planning to use JSON alot, you can save WU costs by handling it client side. I recommend checking out the JSON Assistant plugin by @NoCodeDataArtisan.

1 Like

Make your repeating group type text

Grateful :star_struck:

Your consistent kindness towards us is greatly appreciated. :raised_hands:t2:

Thank you! works wonders :ok_hand:

2 Likes