Trying to inject code directly into JS like in your original post is risky. Someone may be able to use it to inject html/js into the document. The better approach is to insert the JSON data into your HTML document (with normal HTML escaping applied) and then parse it. A hidden input is one way to do that, another way is with a data attribute which is what I typically do (jQuery will auto-parse json data attributes).
<script src="/js/something.js" data-rs="[[1,2,3],[2,3,4],[3,4,5]]"></script>
var rs = $(document.currentScript).data('rs');
document.currentScript needs to be read during the initial script load, you can't put it in an event handler for example. According to caniuse.com, it also doesn't work in IE. If that's a concern, there are alternative methods / polyfills that exist.