Using prototype 1.5.0_rc0 and the Zend Framework (0.1.3) for the json
part i'm able to simple do:

$responses = array('a' => '1', 'b' => '2');
header('X-JSON:'.Zend_Json::encode($responses));

Note i did have to hack Zend_Json first to not quote around the property
names, and only quote around the values, but then it all worked fine and
dandy

        -- Chris

On Sun, 2006-05-28 at 19:36 -0400, Brice Burgess wrote:
> John,
> 
>   I was likely "misforming" my headers. However, here's the PHP code:
> 
>         header('x-json: '.$encoder->encode($json));
> 
>   $encoder->encode($json); just spits out a valid JSON object.
> 
>   If the above was;
> 
>        header('X-JSON: '.$encoder->encode($json));
> 
>   it wouldn't work.
> 
>   However, I'm under the impression that I'm going about it in the wrong 
> manner ;)  Perhaps I set the header... and then the entire return is 
> valid JSON?
> 
> ~ Brice
> 
> 
> 
> John Wang wrote:
> > On 5/28/06, *Brice Burgess* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> 
> > wrote:
> >
> >     Also note that from my experience, the X-JSON header is CASE SENSITIVE
> >     -- and must all be lowercase.
> >
> >
> > What configuration do you run that causes X-JSON in all caps to fail?
> >
> > I find this interesting because:
> >
> > (a) X-JSON in all caps works fine for me using prototype 1.5.0 rc0 
> > with IE 6, Fx 1.5.0.3 <http://1.5.0.3> and Fx 1.0.7.
> >
> > (b) It seems that most of the posts on the Internet use all uppercase. 
> > For example, [ prototype x-json ] in Google returns pages where X-JSON 
> > is in all uppercase. One article says some systems will camelcase 
> > X-JSON to X-Json but prototype isn't affected. I would read that as 
> > X-JSON being not case sensitive and most people use all uppercase.
> >
> > (c) I assume all uppercase works for Chris and Dirk.
> >
> > It would be great if you could provide some software and version 
> > numbers that cause an all uppercase header to fail. I'm curious to 
> > find out what is causing the problem.
> >
> > John
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Rails-spinoffs mailing list
> > [email protected]
> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> >   
> 
> _______________________________________________
> Rails-spinoffs mailing list
> [email protected]
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to