Can’t figure out the right way to break a long parameter to multiple lines

I've created a script to fetch json response from a website. To get the response I had to issue post http requests along with appropriate parameters. The script is doing fine.

The payload that I've used within the script is substantially long. It could have been longer.

Now, my question is, how can I break such long line to multiple lines?

This is how I've tried:

Sub GetJsonResponse()
    Const URL = "https://api.pcexpress.ca/product-facade/v3/products/category/listing"
    Dim payload$

    payload = "{""pagination"":{""from"":2,""size"":48},""banner"":""loblaw"",""cartId"":""702da51e-a7ab-4f54-be5e-5bf38bd6d7a2"",""lang"":""en"",""date"":""09062021"",""storeId"":""1032"",""pcId"":null,""pickupType"":""STORE"",""enableSeldonIntegration"":true,""features"":[""loyaltyServiceIntegration"",""sunnyValeServiceIntegration""],""inventoryInfoRequired"":true,""sort"":{""topSeller"":""desc""},""categoryId"":""27985""}"
    
    With CreateObject("MSXML2.XMLHTTP")
        .Open "POST", URL, False
        .setRequestHeader "content-type", "application/json;charset=UTF-8"
        .setRequestHeader "x-apikey", "1im1hL52q9xvta16GlSdYDsTsG0dmyhF"
        .send (payload)
        Debug.Print .responseText
    End With
End Sub


Read more here: https://stackoverflow.com/questions/67941698/cant-figure-out-the-right-way-to-break-a-long-parameter-to-multiple-lines

Content Attribution

This content was originally published by SMTH at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: