JSON help creating array

Hi there I need to create the below JSON and I am using MSB curl to communicate with a webservice. I work with the dictionary but I cannot seem to code the “amount”: {“value”: “10.00”,“currency”: “EUR”} part of the json.

My code works accept for the amount part. with value 10 and currency EUR. How to code that?

My code

Var details As New JSONItem
// This object is manipulated like a dictionary
details.Value("description") = "App recurring"
details.Value("customerId") = idofcustomer
details.Value("redirectUrl") = "https://www.shop.com/succes"
details.Value("Metadata") = "{\app_user\""12345\}"
details.Value("sequenceType") = "first"

txtjsonrawrequest = details.ToString

My JSON

{
    "amount": {"value": "10.00","currency": "EUR"},
    "description": "application recurring",
    "customerId": "idofcustomer",
    "redirectUrl": "https://www.shop.com/succes",
    "metadata": "{\"app_user\": \"12345\"}",
    "sequenceType":"first"
}

So how to correctly code the above part?

Any help appriciated many thanks!

So how to correctly code the above part?

Var Amount As New JSONItem
Amount.Value("value") = 10.00
Amount.Value("currency") = "EUR"
Details.Value("amount") = amount

Coded here

2 Likes

Many thanks! Quite logical, easy after seeing it! Helped me to correctly finish the webservice call