Can someone help me deserialize JSON from this api https://www.freeforexapi.com/api/live?pairs=EURUSD,GBPUSD to a C# Object? I have tried many ways and examples I found online, non seems to be working
JSON TO C# Deserializing
143 views Asked by Ithra At
2
There are 2 answers
0
Seriy_A
On
for example, using newtonsoft json create class for response
public class EURUSD {
public double rate { get; set; }
public int timestamp { get; set; }
}
public class GBPUSD {
public double rate { get; set; }
public int timestamp { get; set; }
}
public class Rates {
public EURUSD EURUSD { get; set; }
public GBPUSD GBPUSD { get; set; }
}
public class Root {
public Rates rates { get; set; }
public int code { get; set; }
}
and then deserialize response, like
Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
you may use json2csharp website to easy generate classes like this^
Related Questions in C#
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in API
- Google Sheets API - Append Request not working
- Is there really no product for docs that has these?
- How to show suggested content in response using Azure Cognitive Search?
- error message when closing current position in binance futures, using ccxt library
- How to filter API data in React Native
- I have fetched an API with JS, but the output looks really bad and I don't know how to fix it
- Session is not storing in react and Asp Dot Core Web API
- Apex charts not rendering series value, showing cannot map values of NULL
- Configure IIS to accept API calls only from API Manager, Deny from direct calls
- Problems with API return using the Axios library in NextJS
- How to query by Iteration in pyral?
- Is there a way to have a user enter a url query and have a single function filter a database?
- Cant get value in Vue from data
- Read stories/posts using instagram API
- Need To Make Minor Change To REST API Response
Related Questions in HTTP
- Handling both JSON and form values in POST request body with unknown values in Golang
- Why can't I use PUT requests?
- nginx set up reverse proxy from subfolder to a port
- Async Web Server RP2040 returning ERR_CONNECTION_REFUSED?
- Getting `FormatException: Missing extension byte (at offset 6)` exception for accessing `response.body` from a server deployed in Vercel
- Retrieving list of values from MYSQL data base based on input value(LARAVEL 10 )(GET HTTP METHOD)
- Unable to add request headers via CHttpFile - C++/MFC
- Why do we call all http services 'Web Api/Web Service'?
- How to correctly read POST REQUEST body on ESP32?
- on linux gitclone issue remote server error showing fatal error with proxy n port
- Elasticsearch - cascading http inputs from Airflow API
- How to clean the html pages opened in a session?
- UTF-8 is not a valid encoding name
- I dont get the Result i expected when i want to get my Telegram Chatbot id
- NextJS 14 SSE with TransformStream() sending messages in a single response
Related Questions in JSON-DESERIALIZATION
- No method found for class java.lang.String in Kafka
- I dont understand what to do with: System.Text.Json.JsonException: 'The JSON value could not be converted to System.Collections.Generic.IEnumerable`1
- Support Both Object and Array in Json Otherwise it throws MismatchedInputException
- Ignore NULL values in JsonConvert.Deserialize or JToken.Parse
- C# class mapping for System.Text.Json deserialization
- Java Jackson Deserialization - Custom add to list
- how to make aiogram.Message from telethon.Message
- How to get parent node id from child node id in JSON
- How can I assign the property of class after deserializing the object?
- How do I tell the Jackson JSON deserializer to prefer one field over another when both are present?
- JacksonDeserializer fails when json lacks a boolean property
- Deserialize JSON message in run time
- Deserializing JSON to an object - Whole object not being deserialized
- How to get schema or schema ID of JsonNode when using KafkaJsonSchemaSerde
- Deserialize JSON with nested lists from HttpResponseMessage
Related Questions in CSHARPCODEPROVIDER
- I can't get the cameraMatrix , rotation and translation Matrix from the method Cvinvoke.CalibrateCamera()
- C# Roslyn Deleting/Modifing SyntaxNodes
- No overload for method 'Add' takes 3 arguments- Selenium C#
- How to migrate from System.CodeDom.Compiler to Roslyn API?
- Problems implementing dynamic compilation using Microsoft CSharp in Unity
- CsharpCodeProvider target .net framework 4.8
- How to convert a matrix in a drawing.pointf
- problems sending email in C# MVC by sendinblue
- Adding attachments using url in mail with C sharp
- Unload Assembly or AppDomain after Use (like in Object Browser)
- LanguageVersion does not contain a definition for C# 9 after clearing NuGet caches
- C# Chromedriver options in whole program
- Reference Embedded Resource from Codedom Compiled Exe
- .NET Core 5 RawRabbit Serializer/Dependency Injection Issue
- How do I save user settings of combobox in C#?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Here rates is Map, So Response C# class look like this:
To deserialize :