AJAX, XML and JSON

191 views
Skip to first unread message

jlar

unread,
Jul 9, 2008, 3:40:22 AM7/9/08
to Protocol Buffers
Hi people,

Great to see Protocol Buffers (PB) released into the wild. Would you
consider PB useful as a substitute for JSON (and XML) for client-
server communication in AJAX applications? And in that case are you
considering developing a JavaScript API for PB?

Personally I am using (gzipped) JSON for transferring data in my web
applications but a simple binary lightweight format might be useful
for applications requiring lots of data transfer (which we will
probably see more and more of in the future).

Cheers,
Jesper

Wink Saville

unread,
Jul 9, 2008, 10:53:05 AM7/9/08
to jlar, Protocol Buffers
+1

As arguably the most used language, it would be very
beneficial for it to be able to participate.

-- Wink

Kenton Varda

unread,
Jul 9, 2008, 2:09:58 PM7/9/08
to jlar, Protocol Buffers
On Wed, Jul 9, 2008 at 12:40 AM, jlar <jesper....@gmail.com> wrote:

Hi people,

Great to see Protocol Buffers (PB) released into the wild. Would you
consider PB useful as a substitute for JSON (and XML) for client-
server communication in AJAX applications? And in that case are you
considering developing a JavaScript API for PB?

Check out this thread:

http://groups.google.com/group/protobuf/browse_thread/thread/8d815fc7a69e00af

Note that converting protocol message objects to and from JSON is pretty easy to do by writing an encoder/decoder based on protobuf reflection.  It might be more practical to use protobufs only on your server side, then encode them as JSON to send to your AJAX client.  That way you don't have to include a protobuf parser with your Javascript code, reducing the amount of code users have to download.

Blixt

unread,
Jul 10, 2008, 4:59:43 AM7/10/08
to Protocol Buffers
With today's rapid growth of web applications that communicate
frequently with their server, using a compact data format could save
plenty of bandwidth and possibly increase responsiveness slightly.
JSON is itself a pretty compact data format, but Protocol Buffers
would be many times smaller -- especially when there's numeric data
and/or many fields involved.

Considering that it's not that uncommon to see applications
communicating with the server several times per minute (some even do
it every few seconds), I can certainly see the benefits of Protocol
Buffers outweighing the performance lost on the client side.

Regards,
Andreas

On Jul 9, 8:09 pm, "Kenton Varda" <ken...@google.com> wrote:
> On Wed, Jul 9, 2008 at 12:40 AM, jlar <jesper.webm...@gmail.com> wrote:
>
> > Hi people,
>
> > Great to see Protocol Buffers (PB) released into the wild. Would you
> > consider PB useful as a substitute for JSON (and XML) for client-
> > server communication in AJAX applications? And in that case are you
> > considering developing a JavaScript API for PB?
>
> Check out this thread:
>
> http://groups.google.com/group/protobuf/browse_thread/thread/8d815fc7...

Sc00b...@gmail.com

unread,
Jul 10, 2008, 10:16:08 PM7/10/08
to Protocol Buffers
On Jul 9, 2:40 am, jlar <jesper.webm...@gmail.com> wrote:
> Great to see Protocol Buffers (PB) released into the wild. Would you
> consider PB useful as a substitute for JSON (and XML) for client-
> server communication in AJAX applications? And in that case are you
> considering developing a JavaScript API for PB?

I haven't been able to send the null character to IE over AJAX because
it treats the message as c style string. Since PB is a binary format
the null character can show up in any message you send. I've tried
changing "Content-Type" and "Content-Transfer-Encoding" but nothing
worked. Unless there's a simple way to fix it, you won't be able to
use PB in AJAX.
Reply all
Reply to author
Forward
0 new messages