Topic: JSON in XAjax

It seems to me that including JSON technology to XAjax would be the best....
It's not a 'pure AJAX', but
1) it uses less traffick
2) complex structure transfering

at the monent xajax'es xajaxResponse::_buildObj acts like this:
array(
'foo' => array(
   'oof' => 'one',
   'two' => 'foo'
),
'bar' => 'baz'
) structure becomes {foo: undefined, oof: 'one', 'two': 'foo', 'bar': 'baz'} or something like that....
The problem is in object transfering... standard JSON PEAR extension or built-in PHP generates that automatically and uses less resources than XML...

And i've found a problem in beta 2:
i can't retrieve returnValue from xajaxResponse in JavaScript.... How can i do it? xajax.call(...) doesn't work...

Re: JSON in XAjax

Sorry for off-topic, but i don't know where to put this message exactly... move it to another board, if needed... and mail me...

Re: JSON in XAjax

nefo,

There has been some discussion already concerning JSON support... in fact, as of xajax 0.5 beta 2, support has been added for additional response processors... In other words, the kernal is ready for a json extension.  I think the main hold-up is a built in json parser for the php side.  While I understand that there is a PEAR extension for JSON, we don't want to make that PEAR extension a requirement for using xajax.

If you or anyone has some php script for generating and parsing JSON, please let me know, I'd be happy to do the work to embed it in xajax.

Regarding the issue with xajax 0.5 beta 2, I've not had a problem with returnValue(s).  Can you provide an example of your script?  Also, check out the test case in tests/suite ... use the 'callback' test page, the synchronous requests all return a value using this mechanism.

If you continue to have problems with it, please let us know.

// Joe

xajax Developer
Connect to me on LinkedIn:
http://www.linkedin.com/in/calledtoconstruct

Re: JSON in XAjax

Thanks!
... i'll look at 'callbacks' test-page fur sure...

i'm aksing about JSON support in such reason:
it'll be very good if there'll be one standart for xajax json...
for servers where built-in json support is unavailable, there must be some php script, that will encode-decode json structures... Even PEAR extension is suitable, but....
JS-side of JSON command processor is also needed... If there is existing one, give a link... JSON is important for writing some autosuggestion scripts for transmitting big arrays...

Sorry for interupting, but...

Re: JSON in XAjax

@ ctc: thats goods news, at the moment i use the standalone pear-class for json, but an buildin json decoder/encoder would be fine

take a look at this:

http://www.codingforums.com/showthread.php?t=80082

maybe you can find what you are looking for there @ post 1
in post 2 there are other interesting links

Re: JSON in XAjax

Consider using this code: http://pear.php.net/pepr/pepr-proposal-show.php?id=198

It implements the full JSON spec (as far as I see), and unlike the url suggests, does not rely on PEAR yet.

As of PHP 5.2, PHP also has a native JSON extension.

Software developer and Open Source contributor.
Working on KMess, a MSN Messenger client for Linux.

Re: JSON in XAjax

I second this demand for JSON.

I recently had a small programming task where I used Xajax, and the client said he would prefer JSON communication instead of XML.

Thanks to all the good people involved in the Xajax project.

Re: JSON in XAjax

signed

Re: JSON in XAjax

i think the best would be to implement code that uses the native php JSON extension.
PEAR sucks and php4 won´t be supported anymore..

Re: JSON in XAjax

PHP JSON require php 5.2.0.  So if Xajax use this then it will no longer run php 4.

Is that a good thing?  Perhaps!  Since php 4 will end soon any way???

Re: JSON in XAjax

chanh wrote:

PHP JSON require php 5.2.0.  So if Xajax use this then it will no longer run php 4.

Is that a good thing?  Perhaps!  Since php 4 will end soon any way???

Yes, I am in agreement.  Support and new features for php4 apps should stop where it is and we should let the developers concentrate on 5.2+.  Why?  Because this project is in danger of losing users if it cannot meet the latest coding trends of php ajax developers.   Better to be cutting edge and let the older stuff die out than to support the old stuff and lose your foothold.  I, for one, need to see a lighter weight response (as in JSON) without an XML wrapper.  Shouldnt be that hard to accomplish.  Nice if there was just a mode to put xajax into JSON mode (assuming you have right php version you can do it).

Re: JSON in XAjax

The development team is definitely on board with this.  We have been talking about it, but not so much in the public eye (until now).

I'm glad to see this post at this time as we are preparing a RC1 release at the moment.

Please, prepare for this next release by having some space to upload the latest xajax version and test with your applications; take a look at the sample and test scripts (especially in tests/suite/index.php) and report any issues you have with it (once released).

In a very short time, we want to release xajax 0.5 RC1, then xajax 0.5 stable and begin immediately at updating xajax to take full advantage of PHP5.

Thank you for your continued support!

xajax Developer
Connect to me on LinkedIn:
http://www.linkedin.com/in/calledtoconstruct

Re: JSON in XAjax

I was wondering what's the current status of JSON support?

At least in the documentation/tutorials i cannot find anything about it.

pete

Re: JSON in XAjax

peto,

JSON is now the response encoding of choice in xajax 0.6 (though XML is still available if someone really wants to use it).  This is showing a slight performance improvement (and / or decrease in bandwidth usage).

We hope to have an alpha release ready soon.

// Joe

xajax Developer
Connect to me on LinkedIn:
http://www.linkedin.com/in/calledtoconstruct

Re: JSON in XAjax

CtC wrote:

peto,

JSON is now the response encoding of choice in xajax 0.6 (though XML is still available if someone really wants to use it).  This is showing a slight performance improvement (and / or decrease in bandwidth usage).

We hope to have an alpha release ready soon.

// Joe

Wow Json native support is going to be a big change.

Re: JSON in XAjax

CtC wrote:

peto,

JSON is now the response encoding of choice in xajax 0.6 (though XML is still available if someone really wants to use it).  This is showing a slight performance improvement (and / or decrease in bandwidth usage).

We hope to have an alpha release ready soon.

// Joe

Can someone tell the current state of xajax 0.6 ... integration of JSON into xajax?