There is no perfect way.
If you are serious about security, the solution is to not publish your JSON service in the world. Make it private and require that the website and the website use the website to make a confidential request to the server from your server for data. Then you can authenticate whatever you want, and the secrets remain secure in their server code. This is basically a proxy solution. (One nice benefit: your JSON data will now have the same origin as the site, which means you don't have to do JSONP hacks).
If you are less serious about security and just want to make it difficult, the simplest things you have already outlined. Check out the referer. This heading can be faked, but itβs a pain, and I hope most attackers donβt think about trying. It also requires a password and / or API key (they are equivalent) and obfuscation it inside Javascript to make it harder to get.
source share