Avoid json_encode() and Use @json() Blade Directive
But do you know Laravel has awesome blade directive for json_encode. You can use @json for the same task what you do with json_encode. Instead of manually calling
json_encode, you may use the
@json Blade directive. The
@json directive accepts the same arguments as PHP's
Hope it can help you.