CodeIgniter Forums
How to accept json data in codeigniter? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10)
+--- Thread: How to accept json data in codeigniter? (/showthread.php?tid=68937)



How to accept json data in codeigniter? - ktmonty - 09-15-2017

Hello,

 i am getting data from angular2  which is ion json format. its content type  application/json

$fileData = file_get_contents("php://input");

$objFileData = json_decode($fileData);

this way i am accepting data but it does not show any thing in postmat when i try to call that webservice .


RE: How to accept json data in codeigniter? - InsiteFX - 09-16-2017

json_decode creates an associate array 'me' => 'you'.