我正在创建一个具有byte64字符串数据的JSON数组。这是一个无效的JSON,但当我将displaypic
值删除一些正常string
时,JSON有效。请帮我解决一下这个。有没有其他方法可以处理必须在跨平台上解析的图像。我该如何处理这个字节64字符串。
这是一个很长的数据,因此无法在此处添加..正文限制为30000.请参阅此link了解JSON。
创建JSON的代码
function checkLogin_post()
{
//$responsedata = array();
if($this->post('useremail') && $this->post('password'))
{
$useremail = $this->post('useremail');
$password = $this->post('password');
$this->load->model('loginmodel');
$table_data = $this->loginmodel->checkLogin($useremail);
if (sizeof($table_data) != 0)
{
foreach ($table_data as $data)
{
if($password == $data->password)
{
$responsedata["firstname"] = $data->firstname;
$responsedata["lastname"] = $data->lastname;
$responsedata["email"] = $data->email;
$responsedata["userid"] = $data->userid;
$responsedata["displaypic"] = $data->displaypic; //THIS IS THE BASE64
$responsedata["ispersonaldetailsfilled"] = $data->ispersonaldetailsfilled;
$responsedata["isexpertisedetailsfilled"] = $data->isexpertisedetailsfilled;
$responsedata["isprofessionaldetailsfilled"] = $data->isprofessionaldetailsfilled;
$this->response(array("success"=>$responsedata), 200);
//$this->response($responsedata, 200);
}
else
{
$this->response(array("error"=>"Password not matched"), 200);
}
}
}
else
{
$this->response(array("error"=>"User not found"), 200);
}
}
else
{
if($this->post('useremail') == "")
{
$this->response(array("error"=>"Useremail can't be null"),200);
}
if($this->post('password') == "")
{
$this->response(array("error"=>"Password can't be null"),200);
}
}
}
答案 0 :(得分:0)
最后只缺少一个支架。 Here's your corrected JSON
在发布问题之前,始终使用工具验证您的json。我个人喜欢http://pro.jsonlint.com