Skip to main content

json_script

Function json_script 

Source
pub fn json_script<T: Serialize>(id: &str, value: &T) -> SlabResult<Markup>
Expand description

Serialize value as JSON safely embedded inside <script type="application/json" id="...">.

Escapes <, >, &, U+2028, and U+2029 so untrusted strings cannot break out of the <script> tag or smuggle executable HTML/JavaScript.