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" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.