This is a migrated thread and some comments may be shown as answers.

Invalid JSON primitive

2 Answers 323 Views
Fiddler Classic
This is a migrated thread and some comments may be shown as answers.
Manu
Top achievements
Rank 1
Manu asked on 14 Jan 2016, 01:25 PM

I am getting "System.ArgumentException: Invalid JSON primitive:" while i am testing my asp.net web api using fiddler.

 Header is as follows

Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468
User-Agent: Fiddler
Host: trackonpro.in
Content-Length: 8976

Body is as follows

---------------------------acebdf13572468
Content-Disposition: form-data; name="json" 
Content-Type: application/json
{
"WR_id":"0",
"Com_Id": "5",
"Usr_Id":"22",
"WRC_id":"1",
"App_id":"1",
"Ser_LogNo":"2",
"WR_Comments":"Test",
"WR_date":"2015-12-23 01:30:50.000",
"WR_Location":"test",
"WR_lati":"10.45465",
"WR_longi":"70.23654",
"Status_id":"11"
}
---------------------------acebdf13572468
Content-Disposition: form-data; name="fieldNameHere"; filename="download (1).png"
Content-Type: image/png

<@INCLUDE *C:\Users\MANU\Desktop\cv\download (1).png*@>
---------------------------acebdf13572468
Content-Disposition: form-data; name="fieldNameHere"; filename="download.png"
Content-Type: image/png

<@INCLUDE *C:\Users\MANU\Desktop\cv\download.png*@>
---------------------------acebdf13572468--

 

 and the error i am getting is as follows

 

System.ArgumentException: Invalid JSON primitive: "0", "Com_Id": "5", "Usr_Id":"22", "WRC_id":"1", "App_id":"1", "Ser_LogNo":"2", "WR_Comments":"Test", "WR_date":"2015-12-23 01:30:50.000", "WR_Location":"test", "WR_lati":"10.45465", "WR_longi":"70.23654", "Status_id":"11" }. at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer) at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit) at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input) at WebApplication.Areas.Json.Controllers.Work_ReportController.d__4.MoveNext()

 

Kindly please help me to fix it

Thankyou

 

2 Answers, 1 is accepted

Sort by
0
Tsviatko Yovtchev
Telerik team
answered on 19 Jan 2016, 10:36 AM
Hi,

How is the exception related to Fiddler? Does it disappear if you quit  Fiddler?

Regards,
Tsviatko Yovtchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
EricLaw
Top achievements
Rank 1
answered on 31 Jan 2016, 03:51 AM

The user is attempting to use Fiddler's Composer to perform a POST to a web service.

Is there some reason that you're sending the integer values as quoted strings? Typically, I'd expect these to be sent as unquoted float values.

If fixing that doesn't help, I'd have a look at the formatting of the Date object; dates are particularly tricky to encode in JSON as different platforms have different expectations.

Tags
Fiddler Classic
Asked by
Manu
Top achievements
Rank 1
Answers by
Tsviatko Yovtchev
Telerik team
EricLaw
Top achievements
Rank 1
Share this question
or