Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-26-2008, 03:40 AM
Junior Member
 
Join Date: Dec 2007
Posts: 4
Default zend JSON why return double quote ?

I except the result is
{success: true}
but the actual result from the page is
"{success: true}"


it has the quote around the string , why is that ?
how could I remove the quote ?

PHP Code:
    function testAction(){
        
$data "{success: true}";
        
$this->_helper->json($data);

    } 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-26-2008, 02:41 PM
Piro's Avatar
Junior Member
 
Join Date: Apr 2008
Location: Holland
Posts: 8
Default

You shouldn't send it as a string yourself; this is what the Json helper should do for you.

If you create the following array and pass it to the helper it will generate the output you desire.

PHP Code:
        $data = array(
            
'success'    => true
        
);
        
$this->_helper->json($data); 
Output:
Code:
{"success":true}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:12 AM.