I’m trying to upload text to the Answer field of the built in FAQ entity type. Since the field is rich text, the Answer field requires JSON to be uploaded. I made an entity and exported it to see what the JSON format was, and then copied that object into a plugin function so I transform the plain text answer data into the format desired by the platform. This is my mod.ts -
export function createAnswerJson(input: string) {
let answerJson = {
“root”: {
“type”: “root”,
“direction”: “ltr”,
“format”: “”,
“indent”: 0,
“children”: [
{
“type”: “paragraph”,
“direction”: “ltr”,
“format”: “”,
“indent”: 0,
“children”: [
{
“type”: “text”,
“detail”: 0,
“format”: 0,
“mode”: “normal”,
“style”: “”,
“text”: input,
“version”: 1
}
],
“version”: 1
},
],
“version”: 1
}
}
return JSON.stringify(answerJson)
}
I tried both with and without the JSON.stringify, and both give an error when uploading. Is there an easier way to upload to this AnswerV2 field?