Sharing Data - the different forms and what they look like When sharing data with other programs or even humans, we need to agree how to present the data and separate the different fields. For instance, if I tracked the high outside temperatures for the week, how would I share that with you? e.g.
I could just send you the data:
but this is hard to read I could separate them with a space
or a comma
or a tab
When sharing data, 4 different formats are mostly used: 1. CSV - Comma Separated Values This is used mainly by databases like Access where each field or item of data is separated with a comma. If a comma is part of the data, then the whole item is enclosed in quotes (e.g. name = "Smith, Sally").
2. Tab delimited (by spreadsheets like Excel) - not often used by websites
3. JSON (by web pages) Sample: (each field has a name:contents)
4. XML (by programs) Sample: (each field has its own start/end tag)
Below are some samples of actual data: 1a. CSV Formatted Weather Data: -------------------------------------------The Data that is returned ---------------------------------------- #The CSV format is in following way:- #First row will always contain the current weather condition. if for any reason we do not have current condition it will have 'Not Available'. #The current weather condition data is laid in the following way:- #observation_time,temp_C,weatherCode,weatherIconUrl,weatherDesc,windspeedMiles,windspeedKmph,winddirDegree,winddir16Point,precipMM,humidity,visibility,pressure,cloudcover # #The weather information is available in following format:- #date,tempMaxC,tempMaxF,tempMinC,tempMinF,windspeedMiles,windspeedKmph,winddirDegree,winddir16Point,weatherCode,weatherIconUrl,weatherDesc,precipMM # 02:26 AM,6,122,http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0004_black_low_cloud.png,Overcast,4,6,210,SSW,0.2,93,16,1013,100 2014-03-19,7,44,4,38,9,14,130,SE,296,http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0017_cloudy_with_light_rain.png,Light rain,3.2 2014-03-20,13,55,1,34,17,27,283,WNW,113,http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0001_sunny.png,Sunny,0.0 2014-03-21,14,58,6,43,9,15,259,WSW,119,http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0003_white_cloud.png,Cloudy,0.0 -------------------------------------------The Data that is returned ---------------------------------------- 1b. CSV Formatted Stock Data: 2. JSON Formatted Weather Data: -------------------------------------------The Data that is returned ---------------------------------------- { "data": { "current_condition": [ {"cloudcover": "100", "humidity": "93", "observation_time": "02:27 AM", "precipMM": "0.2", "pressure": "1013", "temp_C": "6", "temp_F": "43", "visibility": "16", "weatherCode": "122", "weatherDesc": [ {"value": "Overcast" } ], "weatherIconUrl": [ {"value": "http:\/\/cdn.worldweatheronline.net\/images\/wsymbols01_png_64\/wsymbol_0004_black_low_cloud.png" } ], "winddir16Point": "SSW", "winddirDegree": "210", "windspeedKmph": "6", "windspeedMiles": "4" } ], "request": [ {"query": "20770", "type": "Zipcode" } ], "weather": [ {"date": "2014-03-19", "precipMM": "3.2", "tempMaxC": "7", "tempMaxF": "44", "tempMinC": "4", "tempMinF": "38", "weatherCode": "296", "weatherDesc": [ {"value": "Light rain" } ], "weatherIconUrl": [ {"value": "http:\/\/cdn.worldweatheronline.net\/images\/wsymbols01_png_64\/wsymbol_0017_cloudy_with_light_rain.png" } ], "winddir16Point": "SE", "winddirDegree": "130", "winddirection": "SE", "windspeedKmph": "14", "windspeedMiles": "9" }, {"date": "2014-03-20", "precipMM": "0.0", "tempMaxC": "13", "tempMaxF": "55", "tempMinC": "1", "tempMinF": "34", "weatherCode": "113", "weatherDesc": [ {"value": "Sunny" } ], "weatherIconUrl": [ {"value": "http:\/\/cdn.worldweatheronline.net\/images\/wsymbols01_png_64\/wsymbol_0001_sunny.png" } ], "winddir16Point": "WNW", "winddirDegree": "283", "winddirection": "WNW", "windspeedKmph": "27", "windspeedMiles": "17" }, {"date": "2014-03-21", "precipMM": "0.0", "tempMaxC": "14", "tempMaxF": "58", "tempMinC": "6", "tempMinF": "43", "weatherCode": "119", "weatherDesc": [ {"value": "Cloudy" } ], "weatherIconUrl": [ {"value": "http:\/\/cdn.worldweatheronline.net\/images\/wsymbols01_png_64\/wsymbol_0003_white_cloud.png" } ], "winddir16Point": "WSW", "winddirDegree": "259", "winddirection": "WSW", "windspeedKmph": "15", "windspeedMiles": "9" } ] }} -------------------------------------------The Data that is returned ---------------------------------------- We can add returns to make it more readable and see it's "tree" structure: (It consists of many - "name:value" pairs) -------------------------------------------The Data made to look nice ---------------------------------------- { "data": { "current_condition": [ {"cloudcover": "100", "humidity": "93", "observation_time": "02:27 AM", "precipMM": "0.2", "pressure": "1013", "temp_C": "6", "temp_F": "43", "visibility": "16", "weatherCode": "122", "weatherDesc": [ {"value": "Overcast" } ], "weatherIconUrl": [ {"value": "http:\/\/cdn.worldweatheronline.net\/images\/wsymbols01_png_64\/wsymbol_0004_black_low_cloud.png" } ], "winddir16Point": "SSW", "winddirDegree": "210", "windspeedKmph": "6", "windspeedMiles": "4" } ], "request": [ {"query": "20770", "type": "Zipcode" } ], "weather": [ {"date": "2014-03-19", "precipMM": "3.2", "tempMaxC": "7", "tempMaxF": "44", "tempMinC": "4", "tempMinF": "38", "weatherCode": "296", "weatherDesc": [ {"value": "Light rain" } ], "weatherIconUrl": [ {"value": "http:\/\/cdn.worldweatheronline.net\/images\/wsymbols01_png64\/wsymbol_0017_cloudy_with_light_rain.png" } ], "winddir16Point": "SE", "winddirDegree": "130", "winddirection": "SE", "windspeedKmph": "14", "windspeedMiles": "9" }, {"date": "2014-03-20", "precipMM": "0.0", ...etc } ] } } -------------------------------------------The Data made to look nice ---------------------------------------- 3. XML Weather Formatted Data: This is the data that is returned: -------------------------------------------The Data that is returned ---------------------------------------- <?xml version="1.0" encoding="UTF-8"?><data><request><type>Zipcode</type><query>20770</query></request><current_condition><observation_time>02:28 AM</observation_time><temp_C>6</temp_C><temp_F>43</temp_F><weatherCode>122</weatherCode><weatherIconUrl><![CDATA[http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0004_black_low_cloud.png]]></weatherIconUrl><weatherDesc><![CDATA[Overcast ]]></weatherDesc><windspeedMiles>4</windspeedMiles><windspeedKmph>6</windspeedKmph><winddirDegree>210</winddirDegree><winddir16Point>SSW</winddir16Point><precipMM>0.2</precipMM><humidity>93</humidity><visibility>16</visibility><pressure>1013</pressure><cloudcover>100</cloudcover></current_condition><weather><date>2014-03-19</date><tempMaxC>7</tempMaxC><tempMaxF>44</tempMaxF><tempMinC>4</tempMinC><tempMinF>38</tempMinF><windspeedMiles>9</windspeedMiles><windspeedKmph>14</windspeedKmph><winddirection>SE</winddirection><winddir16Point>SE</winddir16Point><winddirDegree>130</winddirDegree><weatherCode>296</weatherCode><weatherIconUrl><![CDATA[http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0017_cloudy_with_light_rain.png]]></weatherIconUrl><weatherDesc><![CDATA[Light rain]]></weatherDesc><precipMM>3.2</precipMM></weather><weather><date>2014-03-20</date><tempMaxC>13</tempMaxC><tempMaxF>55</tempMaxF><tempMinC>1</tempMinC><tempMinF>34</tempMinF><windspeedMiles>17</windspeedMiles><windspeedKmph>27</windspeedKmph><winddirection>WNW</winddirection><winddir16Point>WNW</winddir16Point><winddirDegree>283</winddirDegree><weatherCode>113</weatherCode><weatherIconUrl><![CDATA[http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0001_sunny.png]]></weatherIconUrl><weatherDesc><![CDATA[Sunny]]></weatherDesc><precipMM>0.0</precipMM></weather><weather><date>2014-03-21</date><tempMaxC>14</tempMaxC><tempMaxF>58</tempMaxF><tempMinC>6</tempMinC><tempMinF>43</tempMinF><windspeedMiles>9</windspeedMiles><windspeedKmph>15</windspeedKmph><winddirection>WSW</winddirection><winddir16Point>WSW</winddir16Point><winddirDegree>259</winddirDegree><weatherCode>119</weatherCode><weatherIconUrl><![CDATA[http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0003_white_cloud.png]]></weatherIconUrl><weatherDesc><![CDATA[Cloudy ]]></weatherDesc><precipMM>0.0</precipMM></weather></data> -------------------------------------------The Data that is returned ---------------------------------------- We can add returns to make it more readable and see it's "tree" structure: (It looks like HTML tags) -------------------------------------------The Data made to look nice ---------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <data> <request> <type>Zipcode</type> <query>20770</query> </request> <current_condition> <observation_time>02:28 AM</observation_time> <temp_C>6</temp_C> <temp_F>43</temp_F> <weatherCode>122</weatherCode> <weatherIconUrl><![http://cdn.worldweatheronline.net/images/png_64/wsymbol_0004_black_low_cloud.png]></weatherIconUrl> <weatherDesc><Overcast ></weatherDesc> <windspeedMiles>4</windspeedMiles> <windspeedKmph>6</windspeedKmph> <winddirDegree>210</winddirDegree> <winddir16Point>SSW</winddir16Point> <precipMM>0.2</precipMM> <humidity>93</humidity> <visibility>16</visibility> <pressure>1013</pressure> <cloudcover>100</cloudcover> </current_condition> ... </data> -------------------------------------------The Data made to look nice ---------------------------------------- That's all there is to it. It looks complicated but that is just because it is so new to you. Do not be overwhelmed by so much data. Just take your time and try to make it more readable. Then look for the items that you want and pull them off the data |
Home > Mashups and Apps Using More Data >
