I have json object like this, the site is running codeigniter which is ultimately the problem.
var obj = {
states : {
'state' : {cities : ['city', 'city2', 'another']},
}
}
the problem is some states have special characters like , or spaces. When those states get added I get a Disallowed Key Characters. error. If I remove the special chars and the space it works fine.
Do I have to resort to some other method?
It turns out that this error was caused by CI’s input library. On line 215 you will find _clean_input_keys function which uses preg_match() to disallow certain characters in your keys. So when you send JSON around and php recieves it as an array it can throw an error.
To fix this you can either extend the library or edit the CI core.