Ok. With all the help I finally found a working solution. Here is the code for anyone who wants to use markdown inside JSON schema (such as FAQ structured data)
{{ `<script type="application/ld+json">` | safeHTML }}
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{{ with $.Page.Params.faq }}
{{ $len := len .section }}
{{ range $index, $element := .section }}
{{ $jsonAnswer := .answer | markdownify | jsonify }}
{{ $jsonAnswer := replace $jsonAnswer "\\u003c" "<"}}
{{ $jsonAnswer := replace $jsonAnswer "\\u003e" ">"}}
{
"@type": "Question",
"name": "{{ .question | markdownify }}",
"acceptedAnswer": {
"@type": "Answer",
"text": {{ $jsonAnswer | safeHTML }}
}
}
{{ if not (eq (add $index 1) $len) }},{{ end }}
{{ end }}
{{ end }}
]
}
{{ `</script>` | safeHTML }}
And this is for using front matter like this
[faq]
title = "Just optional title"
[[faq.section]]
question = "What is this?"
answer = "This is **bold** answer"
[[faq.section]]
question = "What is this?"
answer = "This is *italic* answer"
Kudos to @pamubay for generous amount of help.