Am unable to post json data to api using c# winform with parameter jsondata, the following steps i used to send data every time i tried same issue raising the code & errors are attached to this post.
URL & Datas as follows:
url: https:\\xxx.com\:jsondata
Step 1:
jsondata=
[{
"Name": "Raj",
"Mobile": "5546546556"
},
{
"Name": "Raj",
"Mobile": "5546546546"
}
]
Step 2:
jsondata=
{
"Name": "Raj",
"Mobile": "5546546526"
}
ERROR:
{"status":"FAILURE","Error":"A JSONObject text must begin with '{' at character 1 of &"}
Error Image:

Code in C#:
- public static async Task CallInvoiceAPI(string jsondata, string url)
- {
- try
- {
- HttpClient client = new HttpClient();
- var response = client.PostAsJsonAsync(url, jsondata).Result;
- var content = response.Content;
- var result = await content.ReadAsStringAsync();
- if (result.Contains("SUCCESS"))
- strStatus = "Success";
- else
- strStatus = "Failed";
- }
- catch (Exception ex)
- {
- strStatus = "Failed";
- }
- }

Suman RajPosted Mar 15, 2021, 3:29 AM
Kiran MohantyPosted Mar 14, 2021, 8:38 AM
Suman RajPosted Mar 13, 2021, 6:04 AM
Same issue When i tried this method
Sachin SinghPosted Mar 13, 2021, 5:29 AM