How can I convert a string of comma separated values into valid json, using either php or jquery?
The comma separated strings are stored in a database and are like this:
Singapore,Andora,Australia
The output I need is like this: ["Singapore","Andora","Australia"]
I tried using php's json_encode on the string, but that does not render json the way I need it. It does this "Singapore,Andora,Australia"
Any way I could get this the way I want it?
"Singapore,Andora,Australia".split(',')will return you an array of strings