jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Flavio Cysne <flaviocy...@gmail.com>
Subject Re: Issue while passing JSON string to AJAX request
Date Wed, 24 Jul 2013 13:50:53 GMT
I tested creating a variable, inside my browser console, using those two
JSON strings presented in your e-mail and both returned "Unexpected token
ILLEGAL" error.

Then I tried the JSON string below and it worked.

var myObject =
{"id":"e519e615b0e01d6e80679-a353","nodeId":"WVM","callback":"","args":'{"viewId":"87ec8bd6-b5e4-476d-93ad-4bbbbd6728c2","method":"ModifyControl","args":"{\"id\":\"eed9f0aeae7e4f83b90f1d76f4619d88\",\"args\":null}"}'};

See that I changed the approach of using only quotes for defining string
values and used apostrophes for the args attribute (the first one). I also
removed the extra slashes that turned obsolete because I could use quotes
inside apostrophes without problems.

Maybe using extra slashes could do the work. Anyway, I suppose you are
creating these strings manually, so it should not be an issue for you to
change quotes for apostrophes.


2013/7/24 Niraj <niraj.khatmode@gmail.com>

> Hello,
>
> I am sending one ajax request to the server
>
> http://localtest/Web/AjaxService.asmx/Request?id=e519e615b0e01d6e80679-a353
>
> Post data:
>
> {"id":"e519e615b0e01d6e80679-a353","nodeId":"WVM","callback":"","args":"{\"viewId\":\"87ec8bd6-b5e4-476d-93ad-4bbbbd6728c2\",\"method\":\"ModifyControl\",\"args\":\"{\\"id\\":\\"eed9f0aeae7e4f83b90f1d76f4619d88\\",\\"args\\":null}\"}"}
>
> But when i send this using JMeter, i am getting below error
>
> {"Message":"Invalid object passed in, \u0027:\u0027 or \u0027}\u0027
> expected. (172):
>
> {\"waid\":\"e519e615b0e01d6e80679-a353\",\"nodeId\":\"WVM\",\"callback\":\"\",\"args\":\"{\\\"viewId\\\":\\\"87ec8bd6-b5e4-476d-93ad-4bbbbd6728c2\\\",\\\"method\\\":\\\"ModifyControl\\\",\\\"args\\\":\\\"{\\\\\"id\\\\\":\\\\\"eed9f0aeae7e4f83b90f1d76f4619d88\\\\\",\\\\\"args\\\\\":null}\\\"}\"}","StackTrace":"
>   at
>
> System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeDictionary(Int32
> depth)\r\n   at
>
> System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32
> depth)\r\n   at
>
> System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String
> input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n   at
> System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String
> input)\r\n   at
> System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext
> context, WebServiceMethodData
> methodData)","ExceptionType":"System.ArgumentException"}
>
> Can some please help me to resolve the issue?
>
> Thanks,
> Niraj
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message