

For the JSON example, I have added some comments on other fields you can display. Anyway, once the file, XML or JSON is in the $feed variable, we can extract and print what we want XML has well defined time conversions, the JSON time format is a little awkward (I have seen a fair amount of grumbling on the net about that. It can be a good way to learn the structure of the JSON or XML file.You can think of $feed as being a databse table that you can query to get selected data). Now that your have a $feed variable containing all the file information, you can use a script window to examine the contents of the file. $feed=(new-object ).downloadstring("") Step 4: Work with data in the file $data = $feed -join "`n" | ConvertFrom-Json # Get the raw feed (XML format), and convert to Powershell object # Get the raw feed (JSON format), and convert to Powershell object The USGS has depreciated the QuakeML format, so you may only be able to get the GeoJson format file. NET objectīelow is an example of getting a JSON and XML format data files for the last 4 days of earthquake data. We want to get a file in a specific format (here JSON or XML, and so we need first the file format documentation, and secondly the URL (Uniform Resource Location) of the file. WaterML format (Hydrological time series).GeoJSON Format (Earthquake information).QuakeML Format (Earthquake information).You can work out the format on the fly (I often do), but it is wide to look at the data file in an appropriate editor, I often use my IDE (Visual Studio) for this.

The structure of the XML or JSON file is determined by whom put it together. Google XML or JSON to see more about the file formats in general. XML and JSON help keep data organized and in context. One could use a spreadsheet like file format (a comma or tab delimited file), but there the data can be out of context.

A simple layout of the data is efficient to use. Each earthquake record contains of the same set of data with different values. An earthquake, for example, has a location, time, depth, and other pieces of information. That is, they contain multiple sets of related information. JSON and XML are 'popular' text file formats for data records.
