You can follow what @diegomariani did. While you're at it, check this out: https://gist.github.com/b...
I think @mengidd is right. Validate the data first then convert after. With this, you are sure that...
try view()->share('config', json_encode($config)); then on your views, you can just //js here va...
The Laravel portal for problem solving, knowledge sharing and community building.