Hi and thanks for you response,

I have been having trouble with google not posting my messages, so I
accidentally posted this issue twice.  Additionally, the lengthy
solution I posted to the porblem disappeared as well.  I don't know
why, but I'd rather not post it again.

At any rate, you are correct in that I just never got the JSON format
right.  In the end, the biggest error I made was not including the
parameter in the JSON:

This format proved successful worked:

'{"p_Person":
{"__type":"WebServiceCalls.Person","firstName":"John","lastName":"Smith","greeting":"Hello"}}'


Thanks,
Maulkye


On Sep 10, 8:21 am, "T.J. Crowder" <[EMAIL PROTECTED]> wrote:
> HiMaulkye,
>
> Just off the top of my head, does your JSON looks like this:
>
>     {
>         thingy:  "value"
>     }
>
> or like this:
>
>     {
>         "thingy":  "value"
>     }
>
> The former is not valid JSON syntax.  It is valid JavaScript object
> literal syntax, but not JSON, which is a _subset_ of object literal
> syntax.  The only primitive values (e.g., things you leave out of
> quotes) in JSON are false, true, and null.
>
> So if you're not putting quotes around the things on the left, you
> might try that to see if it's the problem.  Maybe the MS parser is
> being picky.
>
> HTH,
> --
> T.J. Crowder
> tj / crowder software / com
>
> On Sep 4, 1:31 am,Maulkye<[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello all,
>
> > I keep getting this error message (Invalid JSON primitive) when I try
> > to call an Ajax.Request with the 'applicatio/json' content type.  I've
> > tried formatting the parameters in a variety of ways, but no luck.
> > Can anyone help?
>
> > Here's what I have:
>
> > CLIENT:
> >             new Ajax.Request("/myService.asmx/GetComplexData",{
> >                 onSuccess: onSuccess,
> >                 onFailure: onFailure,
> >                 method:"post",
> >                 contentType:"application/json; charset=utf-8",
> >                 parameters: {s: 'bob'}
> >             });
>
> > SERVER:
>
> >         [WebMethod]
> >         public string GetComplexData(string s)
> >         {
> >             return s;
> >         }
>
> > Note that other calls are working.  If I remove the content type, this
> > woks ok, but it just populates the string parameter with the value of
> > "s" from the client.  Additionally, I tried this on the server, but to
> > no avail:
>
> >         [WebMethod]
> >         public string GetComplexData(object s)
> >         {
> >             return "ok";
> >         }
>
> > It seems like there's some way I'm supposed to format the parameters
> > to make MS.NET happy, but I can't figure out how it is.  The server
> > can obviously handle it, because if I use their big fat client library
> > it sends json objects over and puts them into a dictionary object
> > without a hitch.
>
> > If anyone can offer some suggestions of even point in the right
> > direction, I would be most appreciative.
>
> > Thanks,
> > -M
>
> > Full Error Message:
> > -----------------------------
> > {"Message":"Invalid JSON primitive: s.","StackTrace":" at
> > System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePri­mitiveObject()
> > \r\n at
> > System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInt­ernal(Int32
> > depth)\r\n at
> > System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeseriali­ze(String
> > input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n at
> > System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScript­Serializer
> > serializer, String input, Type type, Int32 depthLimit)\r\n at
> > System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T]
> > (String input)\r\n at
> > System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpCont­ext
> > context, JavaScriptSerializer serializer)\r\n at
> > System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData
> > methodData, HttpContext context)\r\n at
> > System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext
> > context, WebServiceMethodData
> > methodData)","ExceptionType":"System.ArgumentException"}- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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 prototype-scriptaculous@googlegroups.com
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