EDIT: For future reference, I\'m using non-xhtml content type definition
I\'m creating a website using Django, and I\'m trying to embed ar
If you are using XHTML, you would be able to use entity references (<, >, &) to escape any string you want within . You would not want to use a section, because the sequence "]]>" can't be expressed within a CDATA section, and you would have to change the script to express ]]>.
But you're probably not using XHTML. If you're using regular HTML, the tag acts somewhat like a CDATA section in XML, except that it has even more pitfalls. It ends with . There are also arcane rules to allow (the comments and opening tag must both be present for to be passed through). The compromise that the HTML5 editors adopted for future browsers is described in HTML 5 tokenization and CDATA Escapes
I think the takeaway is that you must prevent from occurring in your JSON, and to be safe you should also avoid , to prevent runaway comments or script tags. I think it's easiest just to replace < with \u003c and --> with --\>