Array of string in REST request.

0
Hi, I want to construct below request format to consume REST API. I am facing issue in creating the array of string for status attribute. Please help. Is it possible to create array of string in mendix? {   "requestHeader": {          "cmdType": "request",     "cmdMode": "alwaysRespond",     "echoBack": false,     "serviceContext": {       "keepAlive": false,       "channelName": "ABCD",       "debug": false,       "trace": false     }   },   "request": [     {     "accountNumber": "acc012667",     "status": ["Draft","Open","Closed"]   }   ] } Thank you so much in advance.
asked
3 answers
4

Hi Ankush,

just create a JSON structure and copy paste your JSON there. Then refresh the JSON.

Next create a mapping based on the JSONS structure. You will need to use some Wrapper entity with a String attribute (or let Mendix auto generate that for you).

regards, Fabian

answered
1

Mendix cannot create an array of strings. Mendix only knows arrays of object. Maybe you can first generate the json yourself iun a microflow and store it in the string “status”?

answered
1

That is a perfectly valid JSON. What is the problem? Does Mendix not accept the Array of String in the JSON import? Indeed Mendix itself only works with objects, hence creating an array of strings will mostly mean you need a (technical) attribute which will be filled by a concatenated set of strings to store your array of strings in. This concatenated string can then be used as a sort of array of strings.

answered