CodeIgniter Forums
CI2 Disallowed Key Characters in JSON - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: CI2 Disallowed Key Characters in JSON (/showthread.php?tid=64112)



CI2 Disallowed Key Characters in JSON - pigfox - 01-15-2016

In system\core\Input.php.
if( ! preg_match('/^[~a-zA-Z0-9{},:_\/-]+$/i', $str))
{
    exit('Disallowed Key Characters: '.$str);
}
This piece of code triggers Disallowed Key Characters when $str contains:
{"education_level":"1","job_experience":"1","occupation":"41-3011","onet_code"
:"41-3011_00","region":"22220","relevance":"0","school":"0","schoolstate":"0","state":"4","gpa":"0","major"
:"0"}


RE: CI2 Disallowed Key Characters in JSON - InsiteFX - 01-17-2016

See the PHP Manual json_decode() and json_encode()


RE: CI2 Disallowed Key Characters in JSON - tekxpertt - 03-23-2018

You can use this code to disallowed key character in JASON

Find the function _clean_input_keys($str)

Change:

exit('Disallowed Key Characters.');

to:

 exit('Disallowed Key Characters.'. $str);


<input type="text" name="myarray['data1']" \>

And I just changed the input's name.

<input type="text" name="myarray[data1]" \>