How To Get Json Data With Names Enclosed In Quotes Using Cjson

I am trying to generate some JSON data that can be read from a page using ajax. I found some threads that recommend that I use the following format to create the data.

echo CJSON::encode(array(

            "first_name" => $profile->first_name,

             "last_name" => $profile->last_name,

             "photo_url" => Yii::app()->request->getBaseUrl(true).'/assets/pic/thumb/'.$profile->profile_image,            


I get the following results:


    "first_name": "Application",

    "last_name": "Admin",

    "photo_url": "1.jpg"


I am trying to read it using this code:


                    url: "",

                    crossDomain: true,

                    contentType: "application/json; charset=utf-8",

                    dataType: "jsonp",

                    //force to handle it as text

                    //dataType: "text",

                    success: function(data) {

                        //console.log('success in updatProfile js');

                        //data downloaded so we call parseJSON function 

                        //and pass downloaded data

                        var json = $.parseJSON(data);

                        //now json variable contains data in json format

                        //let's display a few items






                   error: function(xhr, status, error) { 

                   	alert('Error !!'+status+error); 


                   async: false,         

                   cache: false                    



I keep getting a parse error, not sure why.

Do you have to use jsonp?

With json you should be able to do this:

success: function(data) {

   if data.first_name == ...