From 9b3d1f893ac0481b7024bd04c11d5f2c82a2d90c Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Mon, 20 Jun 2022 20:35:50 +0200 Subject: [PATCH] Implement `:escape_mode => :slash` Similar to https://github.com/flori/json/pull/405 It's a cheap way to make JSON safe to interpolate in a `"} + Oj.default_options = {:escape_mode => :slash} + out = Oj.dump hash + assert_equal(%{{"key":"I <3 this <\\/script>"}}, out) + end def test_escapes_entities_when_asked_to hash = {'key' => "I <3 this"} out = Oj.dump(hash, :escape_mode => :xss_safe)