I am sending an array from PHP to the document. In the document I am encoding this array to an JSON object, so I can use it with JavaScript:
<script>
var myJSON = <?=json_encode($array)?>;
</script>
My question: Is there is a way to encrypt the JSON, so when the visitor looks at the source code of the document, he won't be able to see the variables in the JSON.
It doesn't have to be a strong encryption, it's OK if it's easily reversible, something like base64 will do. There is no sensitive data in the JSON, I just don't want the content of the JSON to be accessible by the visitor too easily (e.g. right click to view source).
And it would be good if you don't have to install a third party library.
Any ideas would be appreciated!