Encode E-Mail in json response?

Hi,

I’m requesting a json file from a (public) route via js from the frontend.
The json includes some email adresses, that shall be available to the site visitors.

Now regarding spam protection (since the json url is available in the source code) I was wondering, if it would make sense to first Str::encode the email adresses
before sending the json respone, and then decode them again in the js app, - just as I would do it in my HTML-Templates with the Html::email helper.
Or is this an unnessesary extra step and would help nothing?
Also the json response would grow pretty fast…

you could use str_rot13 to encode and decode the email. yes same function for both.

https://www.php.net/manual/en/function.str-rot13.php

1 Like

That’s great, I Didn’t know about rot13.
Thank You Bruno!
Have a good weekend!