Deserialize JSON

Posted on

Question :

I can POST this information:

    "Nritem": 1,
    "Cdprevenda": 3,
    "Cdproduto": 7,
    "Decomplitem": "",
    "Descricao": "Depilação",
    "Dtcadastro": "2015-11-27T13:53:35.120Z",
    "Flsituacao": 1,
    "Md5": "",
    "Qtproduto": 18,
    "Totalizador": "01T1700",
    "Unidade": "UN",
    "Vltabela": 50,
    "Vlunitario": 50,

But if you put between [] this message appears:

"Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'PreVendaWebAPI.Models.Itemprevenda' because the type requires a JSON object (e.g. {"name"":""value""}) to deserialize correctly.rnTo fix this error either change the JSON to a JSON object (e.g. {""name"":""value""}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<

Answer :


that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.rnPath '', line 1, position 1.""]

Leave a Reply

Your email address will not be published. Required fields are marked *