TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Suman Raj
NA
287
13.2k
Can't able to send json data to C# api in winform
Mar 13 2021 4:56 AM
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"
;
}
}
Reply
Answers (
4
)
SharePoint 2016 500 (Internal Server Error) When uploading
C# function example