Output Formats
The Xweather Data API supports multiple output formats to suit your data processing needs. By using the format=
parameter in your request, you can specify the desired format. If omitted, the API defaults to returning data in JSON format.
Format | Description |
---|---|
JSON | The default output format. Returns data as structured JavaScript Object Notation, ideal for web applications and programmatic parsing. |
GeoJSON | A geographic variant of JSON that encodes spatial data (e.g., points, polygons) alongside attributes. Suitable for mapping and GIS tools. |
CSV | Comma-Separated Values. A common flat-file format compatible with spreadsheets and databases. Widely used for analytics and reporting. |
TSV | Tab-Separated Values. A plain text format where each field is separated by a tab character. Useful for spreadsheet tools and data pipelines. |
Header Customization
For CSV and TSV outputs, you can control which columns are included and their order using the fields=
query parameter. This lets you focus only on the data you need and arrange it to match your preferred reporting or integration format.
Example request:
GET /observations?format=csv&fields=ob.windMPH,ob.tempF,ob.humidity,id,obDateTime
ob.windMPH | ob.tempF | ob.humidity | id | obDateTime |
---|---|---|---|---|
7 | 73 | 66 | KFCM | 2025-08-11T11:53:00-05:00 |
Note: Nested object fields remain grouped by their parent key. For example, in the CSV above, all ob.* fields (such as ob.humidity and ob.tempF) must remain together as a block, though their order within that group can be rearranged.