You could just do a quick condition ( (empty($response->number)) ? 0 : json_encode($response->number))
This makes it seems like you are echoing it out from the controller. To keep MVC form I have a function in my AppController(app_controller on 1.3) which I can call with $this->json(arrayhere) It encodes to json, and then uses json.ctp element as the layout. On Feb 3, 4:23 am, Almog <[email protected]> wrote: > I can use some help have a simple bug but figure out what to do. > > I have echo json_encode($response); > > which works fine unless the response is "0" and then I get an empty > "responseVars:" > > If I do echo json_encode($response ->number); > I get responseVars: {"number":0} also incorrect it should just return > "0" > > Any ideas what I'm doing wrong? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
