Exporting Content From Hygraph to CSV in 3 Simple Steps
In this post, we'll take a look at how to export content from Hygraph using the Content API and a JSON to CSV converter.
Exporting content from Hygraph to CSV needn’t be a complex task.
It is often helpful to fetch content from your CMS to analyze marketing plans, perform an SEO audit, or evaluate current content. Hygraph makes it easy to fetch your content with the API Playground in a format that you can easily convert to CSV, and more.
Hygraph uses the JSON format as it’s response type for any API requests. The free online JSON to CSV Converter is an excellent way to convert the API standard “JSON” to CSV.
- Query (optionally filter results) using the API Playground
- Copy JSON result to your clipboard
Paste JSON into JSON to CSV and “Download Result” as CSV
Teams do not need to write custom integration logic to fetch and sync content with other systems. With the JSON to CSV Converter, teams have full control over what data is returning, whether or not to use filters, and what the final converted format should be
Let’s explore fetching data as JSON, and filtering it, as well as exploring the UI for converting JSON to CSV.
Fetching Content as JSONAnchor
Below we will query for “episodes”, and fetch only the fields I want inside my CSV.
The default result size of results returned by queries fetching multiple entries is 100. You can provide a maximum of 1000 to the first, or last arguments. If you need to fetch more results, you can page through data using the pagination filters.
If you only require a certain subset of content entries, add filters or pagination to the GraphQL query, and use the result to convert to CSV.
In the example below, we’ll fetch “episodes” where the
position is within the range 1–10. We can use the
lte filters for this.
Convert to CSVAnchor
Follow the steps to use the JSON to CSV Converter and you will be able to view the CSV results in the browser, or download as a file with a custom filename.
That’s it! You can now fetch as much content from the Content API, in whatever format you require, and convert to CSV.
If you are looking to do the opposite, and import CSV data into Hygraph, Jesse Martin posted on how you can use a free to use low-code approach to do just tha