UPDATE JSON object using Server Connect

Hi, is it possible to output and also update individual elements of a JSON object using server connect functionality?

The JSON is stored in one column in a Postgres database and looks like this…

{"weight": 1.5, "price_exponent": 0, "count": 5, "volume": 0, "collect_weight": true, "collect_category": false, "weight_units": "Kg", "volume_units": "", "weight_si": 0, "volume_si": 0, "collect_count": true, "collect_volume": false, "collect_price": true, "range": 0, "rangevalue": -1, "name": "Danggit", "unit_price": 180, "total_price": 270, "price_currency": "PHP", "typeOfSupply": 3, "isDonation": false, "isPayment": true, "isRecordAfterTP": true}

I want to take each one of the name/value pairs and output into a standard web form and then provide the ability to update some or all of the data.

I can do this in SQL so figured there might be a way to do it using Server Connect.

Thanks.

I’m guessing you could use dmx-repeat on the front-end to iterate over the keys and output a form field with the name attribute (dmx-bind:name="$key", don’t know if that specific syntax works)

I don’t know how to answer this, but can you check a similar topic of mine and see if it helps you?

Thanks for the reply. I did see your earlier post - seems you were trying to do something similar.

I think the update could be done relatively simply in a custom query using…

UPDATE table
SET column_name ->> 'name' = 'value'

I’m going to try that anyway.

Just need to work out how to get the values into a form - your suggestion may help.

Thanks again!