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,168
  • 1
  • 15
  • 21
jkally
  • 794
  • 2
  • 9
  • 35
  • what do you mean? Convert your json string to a byte[] and send it. – slow 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
  • 427
  • 4
  • 18