[jQuery] JSON object as a part of URL

[jQuery] JSON object as a part of URL


Greetings!
I need to pass an object of type
// a,b - strings
function JsonObj(a, b)
{
this.a = a;
this.b = b;
}
as a part of URL
http://localhost/jsonobject/{serialized instance of JsonObj}
As a part of URL, object is properly stringified by json2.js to
http://localhost/jsonobject/{"a":"avalue","b":"bvalue"}
but the request URL in the end is like
http://localhost/jsonobject/%7B%22a%22:%22avalue%22,%22b%22:%22bvalue%22%7D
This results to "Bad Request" response from the server.
What's wrong?
Alternatively could you please suggest better approach?
Previously I used prototype and its toJSON() method worked. Now I use
jquery on the page and there is no room for another library of large
size.
Thanks,
Roman