0

In my post request I need to send data as follows:

{
   "LoginData":{
      "name": "xyz",
      "password": "pw"
   }
}

I have not seen an example of such a header (two levels json)

Ehsan Mohammadi
  • 1,090
  • 1
  • 11
  • 19
jkally
  • 798
  • 2
  • 8
  • 32
  • what do you mean? Convert your json string to a byte[] and send it. – sLw Oct 15 '18 at 08:45
  • 3
    Possible duplicate of [How to post JSON to a server using C#?](https://stackoverflow.com/questions/9145667/how-to-post-json-to-a-server-using-c) – SᴇM Oct 15 '18 at 08:46

1 Answers1

0

You can use HttpClient to achieve this. where you have to create C# class of your json format, you can do it from here. and then serialize your c# object using newtonsoft.json and then use PostAsync method of HttpClient.

Tech Yogesh
  • 407
  • 2
  • 17