mercredi 28 juin 2017

How to Get json data in a single object while post from Rest Client?

I have the following json data which i used in RestClient to post.

{
  "Cars": [
      {
        "color":"Blue",
        "miles":100,
        "vin":"1234"
      },
      {
        "color":"Red",
        "miles":400,
        "vin":"1235"
      }
  ],
  "truck": {
    "color":"Red",
    "miles":400,
    "vin":"1235"
  }
}

and i am trying to get this json in a single object at server side while do post from Rest Client

public JsonResult Post([FromBody]Object Cars)
{
    return Cars;
}

How can i get this json in a single object?




Aucun commentaire:

Enregistrer un commentaire