Get Rid Invalid Character From Generated JSON+LD

Hi, try to generate Json+ld from my single post partial

{ "@context": "http://schema.org", 
 "@type": "BlogPosting",
 "headline": "{{ .Title }}",
 "image": "{{ .Site.BaseURL }}{{ .Params.Image.featured }}",
 "wordcount": "{{ .WordCount }}",
 "url": "{{ .Permalink }}",
 "datePublished": "{{ .Date.Format "2006-1-2" }}",
 "dateCreated": "{{ .Date.Format "2006-1-2" }}",
 "dateModified": "{{ .Lastmod.Format "2006-1-2" }}",  
 "description": "{{ .Description }}",
 "articleBody": "{{ .Plain }}",
   "author": {
    "@type": "Person",
    "name": "{{ .Site.Author.name }}"
  },
 "mainEntityOfPage": "True",
 "publisher": {
  "@type": "Organization",
  "name": "MeutiaRahmah.com",
  "logo": {
  "@type": "imageObject",
  "url": "{{ .Site.BaseURL }}{{ .Site.Params.banner }}"
}
}
 }

I tried to validate using Google Tool and the result is 100% fine, no warning no error. But the result is different when Iā€™m using this tool

The source is from the {{ .Plain }} from my "articleBody" is generate some invalid character. Is there best practice to generate valid content form my articleBody?

UPDATE

I tried {{ .Plain | jsonify }} seems perfect but I have to get rid the double quote wrap. case solved

1 Like

Thank you. That worked for me.