I want to construct a json object in my Copilot chat bot (former PVA) with the following structure:
{
"messages": [
{
"role": "bot",
"content": "message1"
},
{
"role": "user",
"content": "message2"
}
]
}
The tricky part is that I want the strings message1 and message2 to be read from variables.
I tried to create a string and then parse it to json with a schema, but I had no luck with that.
I'll appreciate any suggestions and recommendations.
Thanks in advance
Hi, Thank you for the response, but the problem I want to solve is vice versa. I need to get the value from a variable and apply it on the json object.
best regards
Hi @Gosh ,
I've made a test for your reference:
1\Add a 'Parse value' and set data type to 'From sample data'
2\Get schema form sample JSON
Result
3\Get first message
First(Topic.Var1.messages).content
4\Get last message
Last(Topic.Var1.messages).content
Best Regards,
Bof
Romain The Low-Code...
25
Pablo Roldan
25
stampcoin
10