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
137 Views Asked by Ithra At
2
There are 2 best solutions below
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#
- Passing arguments to main in C using Eclipse
- kernel module does not print packet info
- error C2016 (C requires that a struct or union has at least one member) and structs typedefs
- Drawing with ncurses, sockets and fork
- How to catch delay-import dll errors (missing dll or symbol) in MinGW(-w64)?
- Configured TTL for A record(s) backing CNAME records
- Allocating memory for pointers inside structures in functions
- Finding articulation point of undirected graph by DFS
- C first fgets() is being skipped while the second runs
- C std library don't appear to be linked in object file
- gcc static library compilation
- How to do a case-insensitive string comparison?
- C programming: Create and write 2D array of files as function
- How to read a file then store to array and then print?
- Function timeouts in C and thread
Related Questions in API
- SuiteCRM how to retrieve all account related contacts
- how do i submit a pastebin or pastee from an android app and get the url back
- BigCommerce PHP API delete Category which contains products
- Interact with chrome bookmarks outside of extensions
- purchase individual items and subscriptions in the same PayPal REST API transaction
- youtube api v3 insert comments
- Youtube api v3 duration
- Responding to an Office 365 event invite via REST
- Convert youtube video to mp3 using Quick MP3 API
- How to real-time monitor the emails?
- Laravel - Fractal - Using Find() in transformer file- is it correct or can it be done more efficiently?
- return data from a Azure API json
- Accessing Picasa Web API using PHP
- RAML multivalued form parameter
- TestFlight API and stats with as3
Related Questions in HTTP
- My get request for http is very slow
- Angular multiple http requests chrome android
- HttpRequestContext vs HttpContext
- Converting curl command to iOS
- getting google contacts using shuttlecloud
- Node.js http.get example
- How can hide url value in php
- Symfony2 - handle HTTP/Entity user access restrictions
- Angular http interceptor responseError doesn't have statusText
- Which of the following hostnames are valid?
- Send Http request at specific time
- Rails - read file from POST request / octet-stream
- Python - Cookies & BeautifulSoup
- Npm requests stopped by home router
- POST Android json data
Related Questions in JSON-DESERIALIZATION
- oData deserialization issue in application
- windows phone: deserialise and store both json key and value to modal
- How to display dynamic changing json keys and its values in listview itemtemplate textblock
- Convert String with Underscores to .Net Enum with Standard Naming Convention
- How to configure JSON deserialization in Spring to set null values if JSON property is empty string?
- DeserializeObject only deserialize partly
- JSON deserialization with Stack structure reverses order
- Asp.NET HttpClient with custom JsonConverter
- Read JSON Request and Map to JAVA POJO
- elm: decode json that contains a json array
- Deserialization issue while linking two ArangoDB collection in ArrayList
- Need help to update/create values at runtime in Json.net
- Can not find a (Map) Key deserializer for type [simple type, class java.lang.Class] in Jackson deserialization of JSON into Class
- Deserialize a json container array
- Impossible to fetch data from a json file into php variable
Related Questions in CSHARPCODEPROVIDER
- C# CompilerParameters.OutputAssembly causes application to restart
- Possible to set absolute path for references in CSharpCodeProvider?
- CSharpCodeProvider: Referencing a different version of referenced assembly
- Create Class object from string containing source code
- JSON TO C# Deserializing
- Compiling Partial Classes with CSharpCodeProvider
- CSharpCodeProvider after Obfuscator
- C# Roslyn Deleting/Modifing SyntaxNodes
- I can't get the cameraMatrix , rotation and translation Matrix from the method Cvinvoke.CalibrateCamera()
- Dll referencing in CSharpCodeProvider only works when it's set to .NET 2.0?
- I can't display my array that I have populated through form1Load. Will run without errors but wont run
- C# Casting Array and getting information out of an array of objects
- How to convert a matrix in a drawing.pointf
- CsharpCodeProvider target .net framework 4.8
- How do I programmatically create a windows form?
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)
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?
Here rates is Map, So Response C# class look like this:
To deserialize :