jsonrestquery-stringspecial-charactersazure-logic-apps

Azure logic apps encode left bracket in json query param names to ~2. How can I rewrite with concat and/or replace functions?


I need a method to overcome logic apps' encoding. See "~2" in place of "[" below:

    "parameters~20]~2field]": "date_start",
    "parameters~20]~2value]": "@variables('dateStart')",
    "parameters~20]~2operator]": ">=",
    "parameters~20]~2include_type]": "AND",
    "parameters~21]~2field]": "date_start",
    "parameters~21]~2value]": "@variables('dateEnd')",
    "parameters~21]~2operator]": "<=",
    "parameters~21]~2include_type]": "AND",
    "parameters~22]~2field]": "qty_open",
    "parameters~22]~2value]": "0",
    "parameters~22]~2operator]": ">",
    "parameters~22]~2include_type]": "AND",
    "parameters~23]~2field]": "credit_status",
    "parameters~23]~2value]": "Approved",
    "parameters~23]~2operator]": "=",
    "parameters~23]~2include_type]": "AND",
    "pagination~2page_size]": body('MyCompany_V3_API_Vendor_Authentication')?'page_size']",
"pagination~2last_id]": "@variables('last_id')"

I tried various ways of concatenating the parts of param names with logicapp/json compatible functions to convert the encoding. I also tried @replace. I always seem to be running into the problem of single quotes getting along with double quotes.


Solution

  • You can make the given changes to get the expected response.

    {
        "@{replace('parameters~20]~2field]', '~2', '[')}": "date_start",
        "@{replace('parameters~20]~2value]', '~2', '[')}": "ABC",
        "@{replace('parameters~20]~2operator]', '~2', '[')}": ">=",
        "@{replace('parameters~20]~2include_type]', '~2', '[')}": "AND"
    }
    

    You will get below response.

    enter image description here