i want to pass this as html body and put variables instead of static values
{
"name": "DI_3214162_NIA",
"status": "todo",
"document": {
"id": "5b7df7a4-f854-4917-97b5-ab923b81e982"
},
"asset": {
"id": "c356cfad-0f05-4bb3-a225-ff3538550f9b"
},
"users": [
{
"id": "20b069aa-6eb8-4b27-b404-f34d892a02e3"
}
],
"attributes": [
{
"operator": "equals",
"id": "f1935d88-a11f-4800-9232-ccc3775efe78",
"value": {
"text": "DI"
}
},
{
"operator": "equals",
"id": "8e8cb509-b7d6-47ca-99ea-3c2591b561d2",
"value": {
"text": "No DI : 3213933."
}
}
],
"planning": {
"planned_end_date": "2019-08-19T18:00:11+02:00",
"planned_start_date": "2019-08-19T17:30:11+02:00",
"planned_timezone": "Europe/Paris"
}
}
loginerror
(Maciej Kuźmicz)
August 28, 2020, 2:33pm
2
Hi @oumayma_lajili1
It is doable using the String.Format(yourInputString,"")
syntax.
First, replace your values with a placeholder {0}
, like so…
{{
"name": "{0}",
"status": "{1}"
}}
…and so on.
Then, use this in Studio to feed it your variables:
String.Format(input,yourVariableFor0Here, yourVariableFor1Here).ToString
It will replace the placeholders in the order you put the variables into the expression.
Keep in mind that for JSON string, you will want to escape all { with {{ except for the placeholders in your source text file , like so:
{{
"name": "{0}",
"status": "todo",
"document": {{
"id": "5b7df7a4-f854-4917-97b5-ab923b81e982"
}},
"asset": {{
"id": "c356cfad-0f05-4bb3-a225-ff3538550f9b"
}},
"users": [
{{
"id": "20b069aa-6eb8-4b27-b404-f34d892a02e3"
}}
],
"attributes": [
{{
"operator": "equals",
"id": "f1935d88-a11f-4800-9232-ccc3775efe78",
"value": {{
"text": "DI"
}}
}},
{{
"operator": "equals",
"id": "8e8cb509-b7d6-47ca-99ea-3c2591b561d2",
"value": {{
"text": "No DI : 3213933."
}}
}}
],
"planning": {{
"planned_end_date": "2019-08-19T18:00:11+02:00",
"planned_start_date": "2019-08-19T17:30:11+02:00",
"planned_timezone": "Europe/Paris"
}}
}}
1 Like
hello , is this the right string format ? because i got an error not valid string format
{{ "name":"{0}",
"status":"todo",
"document":{{"id":"{1}"}}
,"asset":{{"id":"{2}"
} },
"users":[{{"id":"{3}" } }]
,"attributes":[{{"operator":"equals",
"id":"f1935d88-a11f-4800-9232-ccc3775efe78",
"value":{{"text":"DI"}} }},
{{"operator":"equals",
"id":"8e8cb509-b7d6-47ca-99ea-3c2591b561d2",
"value":{{"text":"{4}" } } }}],
"planning":{{
"planned_start_date":"{5}" ,
"planned_end_date":"{6}",
"duration":86400 }}
}}
loginerror
(Maciej Kuźmicz)
September 2, 2020, 5:55am
5
Some of the curly brackets are not escapes. There should be no space between the actual bracket and its escape sign, so always {{ or }} and never { { or } }
1 Like
thanks a lot for this Information . It works for me
1 Like
system
(system)
Closed
September 5, 2020, 6:35am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.