Dollar / Euro Currency Exchange Rate Convertor in C# using JSON – Programming, Pseudocode Example, C# Programming Example
C#

Dollar / Euro Currency Exchange Rate Convertor in C# using JSON

These examples are prepared for converting American dollars into Euro currency and vice verca.
 Two seperate samples are made for two seperate JSON sources. JSON Objects in both samples will be different from each other.

 

Step 1: As the first stage, for analyzing (processing) the JSON files, I constitude the NeWTON library as follows:

 

Step 2: Add Newtonsoft.Json reference in  “using”.

Step3:  Choose the currency we want to convert from the address below:

http://www.floatrates.com/json-feeds.html

 

I choose ” Dollar” because I want to convert dollars into other currencies

http://www.floatrates.com/daily/usd.json

 

Step 4: code writings and explanations:
You can see all currencies in the dynamic “currency” object

Printing “currency” object will be sufficient for seeing all currencies

To Read the Euro currency rate, you must write the first line of following code (currency.eur.rate).
if you also want to convert Euro to Dollar ,you must write the second line of following code (currency.eur.inverseRate).

 

Sample Application 1: If we want to show the code in a simple console application, we can do the following.

 

Sample Application 1: The same example created with another JSON API

For Dollar to Euro : http://api.openrates.io/latest?base=USD

For Euro to Dollar : http://api.openrates.io/latest?base=EUR

 

 

 

1 Comment

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: