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
Muthu vj
1.6k
162
9.2k
Input string was not in a correct format
Apr 29 2021 4:29 PM
hi,
{ "endpoint": "live", "quotes": [ { "ask": 1.21153, "base_currency": "EUR", "bid": 1.21153, "mid": 1.21153, "quote_currency": "USD" }, { "ask": 1.39483, "base_currency": "GBP", "bid": 1.39481, "mid": 1.39482, "quote_currency": "USD" } ], "requested_time": "Thu, 29 Apr 2021 16:19:11 GMT", "timestamp": 1619713151 }
this is my Result i want to get the output from API and deserialized it i tried it but got the
Input string was not in a correct format: c#
Error can you help me on that
private
async
void
getCurrentPrize() {
HttpClient client =
new
HttpClient();
//
HttpResponseMessage response = await client.GetAsync(
"https://financialmodelingprep.com/api/v3/fx/EURUSD,USDINR,USDCAD,XAUUSD,XAGUSD,GBPUSD,EURJPY,AUDUSD?apikey=xxxxxxxxxxxxxxxxxxxx"
);
HttpResponseMessage response = await client.GetAsync(
"https://marketdata.tradermade.com/api/v1/live?currency=EURUSD,GBPUSD&api_key=_xxxxxxxxxxxxx"
);
response.EnsureSuccessStatusCode();
var responseBody = await response.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject < CurrencyDetails > (responseBody);
CurrencyDetails deserialized =
new
CurrencyDetails();
foreach
(var item
in
result.quotes) {
//my logic here }
public
class
CurrencyDetails {
public
string
endpoint {
get
;
set
;
}
public
List < quotes > quotes {
get
;
set
;
}
public
string
requested_time {
get
;
set
;
}
public
long
timestamp {
get
;
set
;
}
}
public
class
quotes {
public
double
ask {
get
;
set
;
}
public
double
bid {
get
;
set
;
}
public
string
base_currency {
get
;
set
;
}
public
double
mid {
get
;
set
;
}
public
string
quote_currency {
get
;
set
;
}
}
Reply
Answers (
3
)
In ASP.NET, event is the last event that provides scope to control the
Face Error Model