Convert a CSV file on the web to JSON

Load a CSV file from a web link and transform it into a JSON format.

Overview

This template shows a basic example of how to convert data on the web from a CSV to a JSON format. You can use this to reformat data loaded from a web page or an API request or use it as a conversion step in a serverless data feed.

Code template

Common uses

For simple format changes, this is a handy way to convert data in a single step. Some common uses for this include:

  • Converting a CSV file in order to manipulate it as a JSON object or to display it on a web page
  • Processing and transforming data from an API call that only returns data in a CSV format
  • Reformatting data for other tasks in a pipe that require the data in a JSON format

Extend it

You can reformat data in other ways as well, such as converting data from JSON to a CSV, or to a table. You can also add a filter task to a pipe to only bring down a portion of the data from a web link or an API request.

Example 1

Convert a CSV file to a table and filter the rows before returning it.

Example 2

Convert data in a JSON format to a table in order to flatten it in a generic way.