Skip to content
Advertisement

Php how to add backslash inside array of strings

I have a below array:

 Array
    (
        [0] => CLICK
        [1] => CSC
    )

After json_encode I got below one.

"["CLICK","CSC"]"

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