tags:

views:

121

answers:

1

I'm trying to create a JSON object on client-side and pass to a server-side function. Then instantiate it on server-side using JSON string representation.

So I create jSON object on client-side

 var myJsonObject = {
        "arg1": var1,
        "arg2": var2
    }

and pass it in to

    WebForm_DoCallback(controlID, myJsonObject , null, null, null, true);

When I try to retrieve this JSON object on server-size I get as a string representation of JSON [object Object]

So in following server-side function, the argument value is [object Object]

public void RaiseCallbackEvent(string jsonObj)

I was expecting a string representation of JSON object. How do I pass in a string representation?

+2  A: 

It needs to be serialized (stringified). Try this: http://www.json.org/json2.js.

Caleb
thanks. i forgot about JSON.stringify function
dev.e.loper