Skip to content
Advertisement

Php how to add backslash inside array of strings

I have a below array:

JavaScript

After json_encode I got below one.

JavaScript

How to convert this into "["CLICK","CSC"]" this.

Any one help.

Advertisement

Answer

Some info was missing which I got after discussion.

They are manually replacing a lot of characters before returning json. Out of them they also include [ => "[ and ] => ]" due to their backend implications.

A simple json_encode was solution for this along with skipping those character replacement for specific this key.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement