Member-only story
How I Used ChatGPT to Convert a Complex Nested JSON to a CSV File
Introduction
Working with complex, nested JSON data is a challenge many data professionals face. Typically, we might write several lines of Python to parse out specific fields, handle pagination, and even engineer custom columns. However, I recently discovered a surprising solution: using an AI language model to handle the bulk of this work.
In this article, I’ll walk you through how I used an LLM (Large Language Model) to transform a deeply nested JSON API response into a clean, organized CSV file with custom columns, using plain English instructions.
The Problem: Converting a Nested JSON into CSV
I needed a CSV file with some basic information about Nobel laureates. The official API returned only nested JSON data (see below for an example). This JSON contained details about laureates, each with varying attributes like names, achievements, and associated organizations. It is a complex nested JSON as you can see in the image below.
Tip: Try JSONCrack to make sense of nested JSON files; it’s incredibly useful for understanding JSON…