Array to JSON
To display array values in JSON format, you need to use json_encode(). For eg: $arr = array('username' => 'test','userid' =>'1', 'password' => 'test123'); // Use json_encode to return in json format echo json_encode($arr); Output: {"username":"sham dhar","userid":"36","password":"test123"}

Comments
Post a Comment