Array to Json

Hello Team,
Can we pass Array of string into Json.
Actually i have a variable of array to string i need to pass it to json instead of giving manual array in json in form builder.

Please guide,
Thank you

@msalesforce777
grafik

NewtonSoft.Json.JsonConvert.SerializeObject({“A”,“B”})

Can i directly pass variable to it

grafik

This is my json,
{
“label”: “LO Tax”,
“labelPosition”: “top”,
“placeholder”: “Please enter LO Tax”,
“description”: “”,
“prefix”: “”,
“suffix”: “”,
“widget”: {
“type”: “input”
},
“inputMask”: “”,
“hidden”: false,
“hideLabel”: false,
“showWordCount”: false,
“showCharCount”: false,
“disabled”: false,
“alwaysEnabled”: false,
“tableView”: true,
“defaultValue”: null,
“validateOn”: “change”,
“validate”: {
“required”: false,
“pattern”: “”,
“custom”: “console.log(input);\nvalid = ([‘arr’, ‘nam’].includes(input.toLowerCase()))”,
“customMessage”: “”,
“minLength”: “”,
“maxLength”: “”,
“customPrivate”: false,
“strictDateValidation”: false
},
“errorLabel”: “”,
“key”: “loTax”,
“conditional”: {
“show”: null,
“when”: null,
“eq”: “”
},
“type”: “textfield”,
“input”: true,
“customClass”: “”,
“multiple”: false,
“protected”: false,
“unique”: false,
“persistent”: true,
“clearOnHide”: true,
“refreshOn”: “”,
“redrawOn”: “”,
“tooltip”: “”,
“tabindex”: “”,
“autofocus”: false,
“dbIndex”: false,
“customDefaultValue”: “”,
“calculateValue”: “”,
“attributes”: {},
“overlay”: {
“style”: “”,
“left”: “”,
“top”: “”,
“width”: “”,
“height”: “”
},
“allowCalculateOverride”: false,
“encrypted”: false,
“properties”: {},
“allowMultipleMasks”: false,
“mask”: false,
“inputType”: “text”,
“inputFormat”: “plain”,
“id”: “e48wrj”
}

The Bold part needs to be replaced by array of string variable, How it can be done

lets assume

  • the json is the value of a string Variable e.g. strJSON
  • [‘arr’, ‘nam’] is a unique token within strJSON

then you can do (String Base)
Assign Activity
left side: strPartJSON
right side: NewtonSoft.Json.JsonConvert.SerializeObject(arrStringVar)

Assign Activity:
left side: strJSONEdited
right side: strJSON.Replace("['arr', 'nam']",strPartJSON)