@@ -71,14 +71,8 @@ public string FromCountryConfirmed(string country)
7171 //Deserializes the response
7272 JObject output = ( JObject ) JsonConvert . DeserializeObject ( response . Content ) ;
7373
74- //Stores the 'locations' node in the locations variable
75- var locations = output [ "locations" ] ;
76-
77- //Stores the 'id' sub node of the 'locations' node in the IdInfo variable
78- var IdInfo = locations [ 0 ] ;
79-
80- //Stores the 'latest' sub node of the 'id' sub node in the LatestData variable
81- var LatestData = IdInfo [ "latest" ] ;
74+ //Stores the 'latest' node in the LatestData variable
75+ var LatestData = output [ "latest" ] ;
8276
8377 //The 'confirmed' sub node of the 'latest' sub node is fetched and converted into a string
8478 var CountryConfirmedData = LatestData [ "confirmed" ] . ToString ( ) ;
@@ -96,16 +90,10 @@ public string FromCountryRecovered(string country)
9690 //Deserializes the response
9791 JObject output = ( JObject ) JsonConvert . DeserializeObject ( response . Content ) ;
9892
99- //Stores the 'locations' node in the locations variable
100- var locations = output [ "locations" ] ;
101-
102- //Stores the 'id' sub node of the 'locations' node in the IdInfo variable
103- var IdInfo = locations [ 0 ] ;
104-
105- //Stores the 'latest' sub node of the 'id' sub node in the LatestData variable
106- var LatestData = IdInfo [ "latest" ] ;
93+ //Stores the 'latest' node in the LatestData variable
94+ var LatestData = output [ "latest" ] ;
10795
108- //The 'confirmed ' sub node of the 'latest' sub node is fetched and converted into a string
96+ //The 'recovered ' sub node of the 'latest' sub node is fetched and converted into a string
10997 var CountryRecoveredData = LatestData [ "recovered" ] . ToString ( ) ;
11098 return CountryRecoveredData ;
11199 }
@@ -121,16 +109,10 @@ public string FromCountryDeaths(string country)
121109 //Deserializes the response
122110 JObject output = ( JObject ) JsonConvert . DeserializeObject ( response . Content ) ;
123111
124- //Stores the 'locations' node in the locations variable
125- var locations = output [ "locations" ] ;
126-
127- //Stores the 'id' sub node of the 'locations' node in the IdInfo variable
128- var IdInfo = locations [ 0 ] ;
129-
130- //Stores the 'latest' sub node of the 'id' sub node in the LatestData variable
131- var LatestData = IdInfo [ "latest" ] ;
132-
133- //The 'confirmed' sub node of the 'latest' sub node is fetched and converted into a string
112+ //Stores the 'latest' node in the LatestData variable
113+ var LatestData = output [ "latest" ] ;
114+
115+ //The 'Deaths' sub node of the 'latest' sub node is fetched and converted into a string
134116 var CountryDeathsData = LatestData [ "deaths" ] . ToString ( ) ;
135117 return CountryDeathsData ;
136118 }
0 commit comments