Do you mean a json_parse in javascript (like a better eval() I assume)? Thats what we were doing. Json is not supposed to be pure javascript either, but a serialized representation of variables like php's serialize(). So I would not expect a json string to be usable without using eval or something else in javascript first. We had to modify the php json_encode output to be wrapped with a couple extra braces for it to be able to be consumed properly on javascript (or maybe it was the other way around) - I just want to make sure we won't have to make special things like that in the future.

On Dec 13, 2008, at 10:52 PM, Rasmus Lerdorf <ras...@lerdorf.com> wrote:

Yes, but that would be going to a json_parse thing somewhere, not pure
Javascript.

-Rasmus

mike wrote:
I can't give specifics (I'm mobile and I don't remember where the code
would be anyway) but we had an issue with php and javascript exchange
via json where the php output using json_encode and we had to wrap it
with additional braces for it to be usable. Sorry for being vague, this
thread reminded me of that which is why I wanted to voice off.

Thanks for the clarification (and thank you so much for PHP :))

On Dec 13, 2008, at 10:39 PM, Rasmus Lerdorf <ras...@lerdorf.com> wrote:

mike wrote:
Sorry for top posting. I see no reason why php should not interop with
javascript 100% as it should. I do not see a reason to create new
functions, parameters, etc. The existing should be expected to both
encode and decode json with javascript properly. If there is a mismatch
right now, then it should be fixed.

There is no mismatch with Javascript now at all. We spit out perfectly
valid Javascript.  There is only a slight mismatch with the JSON RFC
which defines a stricter subset of Javascript than we are using.

-Rasmus


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to