Dynamically replace parts of JSON for server-side API action


#1

If I want to submit a server-side API action with JSON, and I have substructures in the JSON, then I currently have to use this method described by @George. Which does work, but is not all that user friendly / easy.

Let’s say this is the JSON:

{
    "order": {
        "status": "OPEN",
        "reference": "#12345",
        "brand": "brand_name",
        "products": {
            "product_id": "ABC123",
            "quantity": 3
        }
    }
}

It would be ideal if we could replace the text dynamically, like so:

{
    "order": {
        "status": "OPEN",
        "reference": "{{$_POST.reference}}",
        "brand": "{{$_POST.brand}}",
        "products": {
            "product_id": "{{$_POST.pid}}",
            "quantity": {{$_POST.quantity}}
        }
    }
}

Just by replacing text with copy and paste. Or some other way where the JSON is fully in view. This would make it far easier to do JSON api call with substructures.