Invalid JSON primitive

3 posts, 0 answers
  1. Manu
    Manu avatar
    1 posts
    Member since:
    Jan 2014

    Posted 14 Jan Link to this post

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

     Header is as follows

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

    Body is as follows

    Content-Disposition: form-data; name="json" 
    Content-Type: application/json
    "Com_Id": "5",
    "WR_date":"2015-12-23 01:30:50.000",
    Content-Disposition: form-data; name="fieldNameHere"; filename="download (1).png"
    Content-Type: image/png

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

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


     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



  2. Tsviatko Yovtchev
    Tsviatko Yovtchev avatar
    391 posts

    Posted 19 Jan Link to this post


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

    Tsviatko Yovtchev
    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
  3. EricLaw
    EricLaw avatar
    67 posts
    Member since:
    Oct 2012

    Posted 30 Jan in reply to Manu Link to this post

    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.

Back to Top