json returned from CI REST API is failing jsonlint tests

后端 未结 3 665
天涯浪人
天涯浪人 2021-01-28 08:05

I have the following code in a codeigniter REST app (built using: https://github.com/chriskacerguis/codeigniter-restserver)

public function fullname_get()
{
   $         


        
3条回答
  •  没有蜡笔的小新
    2021-01-28 08:17

    Try this

     $fullname = array("fname"=>"john", "lname"=>"doe");
     $this->response($fullname, 200);//it sends data json format. You don't need to json encode it
    

    You got that response because your data is json encoded twice

提交回复
热议问题