I'm passing a JSON String ({"myData":"data"}
) to my rendered page like so:
render(view: 'myPage', model: [jsonData: JSONStr]);
then on the page template:
<meta content='http://www.myDomain.com/video?config=${ (jsonData) }' property="og:video" />
the result is:
<meta content='http://www.myDomain.com/video?config={"myData":"data"}' property="og:video" />
Is There a way to prevent escaping of the JSON data?
I fixed it with a TagLib
class SimpleTagLib {
def unescaped = { attrs ->
out << attrs.value
}
}
<meta content='http://www.myDomain.com/video?config=${g.noEncode(value:jsonData)}' property="og:video" />