Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the user-registration
domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init
action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/functions.php on line 6121
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the hashone
domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init
action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/functions.php on line 6121
Warning: Cannot modify header information - headers already sent by (output started at /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/functions.php:6121) in /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/rest-api/class-wp-rest-server.php on line 1896
Warning: Cannot modify header information - headers already sent by (output started at /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/functions.php:6121) in /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/rest-api/class-wp-rest-server.php on line 1896
Warning: Cannot modify header information - headers already sent by (output started at /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/functions.php:6121) in /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/rest-api/class-wp-rest-server.php on line 1896
Warning: Cannot modify header information - headers already sent by (output started at /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/functions.php:6121) in /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/rest-api/class-wp-rest-server.php on line 1896
Warning: Cannot modify header information - headers already sent by (output started at /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/functions.php:6121) in /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/rest-api/class-wp-rest-server.php on line 1896
Warning: Cannot modify header information - headers already sent by (output started at /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/functions.php:6121) in /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/rest-api/class-wp-rest-server.php on line 1896
Warning: Cannot modify header information - headers already sent by (output started at /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/functions.php:6121) in /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/rest-api/class-wp-rest-server.php on line 1896
Warning: Cannot modify header information - headers already sent by (output started at /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/functions.php:6121) in /customers/c/c/d/ccloudonline.nl/httpd.www/wp-includes/rest-api/class-wp-rest-server.php on line 1896
{"id":1064,"date":"2017-05-12T08:32:11","date_gmt":"2017-05-12T08:32:11","guid":{"rendered":"http:\/\/ccloudonline.nl\/?page_id=1064"},"modified":"2018-10-07T02:26:23","modified_gmt":"2018-10-07T02:26:23","slug":"get-world-countries-and-cities-weather-with-their-geolocations-api-json-part-ii","status":"publish","type":"page","link":"http:\/\/ccloudonline.nl\/?page_id=1064","title":{"rendered":"Get World Countries and Cities Weather with their Geolocations (API -JSON) Part II"},"content":{"rendered":"
So now we have our JSON response displayed on a Visualforce page, but let’s be honest… is not readable for everyone. We are going to make a few changes to our class and write extra code to make sure that users can read and interact with the data we are receiving from our HTTP call.<\/p>\n
We are not going to add every single field from the response into this page, instead, we are going to use the one URL that comes as part of the response to display things in a more proper way. We are going to capture some of the most simple errors on this page, nothing fancy. The first thing we are going to do is to build an Apex class from the response. We can accomplish this by copying our response and using this site<\/a>. JSON2Apex is a well-known website to transform your JSON responses into Apex Classes, it will save us a lot of time.\u00a0<\/p>\n After converting your JSON into APEX you will have a pretty long apex class. We are going to use a small portion of that call for this example. <\/p>\n Check out what it is that we need from that apex class coming from JSON2Apex. I created a new class with the name ‘JSONWeatherLocation’ and from the apex class, I’m going to use the ‘location’ class as you can see. [code lang=”php”] public location location{get;set;}<\/p>\n public class location{<\/p>\n public String magic{get;set;}
\nThis class contains a number of fields that are the fields I want to display on my Visualforce page. <\/p>\n
\n\/**************************************************************
\n* @Author : Carlos Naranjo
\n* @Website : http:\/\/ccloudonline.nl – http:\/\/ccloudonline.com
\n*
\n***************************************************************\/
\n public class JSONWeatherLocation {<\/p>\n
\n public String wmo{get;set;}
\n public String zip{get;set;}
\n public String l{get;set;}
\n public String lon{get;set;}
\n public String requesturl{get;set;}
\n public String lat{get;set;}
\n public String wuiurl{get;set;}
\n public String tz_long{get;set;}
\n public String country_name{get;set;}
\n public String state{get;set;}
\n public String country_iso3166{get;set;}
\n public String city{get;set;}
\n public String country{get;set;}
\n public String tz_short{get;set;}
\n }
\n }
\n[\/code]<\/p>\n