2008/9/27 darrinholst <[EMAIL PROTECTED]>

>
> I was going to inject my own thoughts on this, but I found this thread
> instead...
>
>
> http://groups.google.com/group/prototype-core/browse_thread/thread/140fdf88eed057d/1c466af382e9ba54?lnk=gst&q=toQueryString#
>
> Some good reading, but I'm not sure what ever came out of it. I looked
> at Tobie's branch (which I think might be the next release?) and it
> totally skips objects that are not Arrays. I think nested hashes would
> be useful if you're using a server side language/framework that
> understands the format that the client put it in, but since Prototype
> should be server agnostic then I think you're going to have to roll
> your own.
>
> I primarily use Java, so when I need a complex object sent to the
> server I've always just converted it to a JSON string and then parsed
> it back out server side.


I know we're getting a little OT here, but just to emphasize Darrin's point,
I think there's a good reason for leaving toQueryString as-is.

I do the same (or similar) thing as Darrin. If you really have nested hashes
on the client side, you're probably working with data that's complex enough
that you should have a corresponding object on the server side. Then you can
use any of the bazillion JSON->[Insert Language Here]
converters/deserializers to translate your data, and you don't need to work
with just the primitive values...instead, you get to work with actual
objects. Intead of (say, in PHP) $_GET["name"] and $_GET["id"]...etc, etc,
etc, you could do $_GET["myobject"] and (in addition to some parsing, or the
JSON->...libraries) handle it as a REAL object from that point forward.

I work with ASP.Net web services a lot, and when I write my web services, I
always write a very simple overloaded version that takes a JSON string,
converts to the appropriate object, and then calls the matching web service,
ie:

UpdateCustomer(Customer c);

and

UpdateCustomerJSON(string CustomerJSON);

This way, you can simply convert the CustomerJSON string to a Customer
object, which makes for cleaner code both on the client and server side,
because you maintain your object structure.

Just my $0.02

-Jerod

>
>
> Darrin
>
> >
>


-- 
Jerod Venema
Senior Software Engineer
Nth Penguin, LLC
http://www.nthpenguin.com
(919) 368-5105
---
WebWidgetry.com / MashupStudio.com
Future Home of the World's First Complete Web Platform

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to