--
title: "CSV vs JSON in Your X Archive: What Each Format Can Actually Do"
description: "An X archive mixes a set of csv tables with a set of js files that actually contain JSON. The names look similar, the capabilities are not. What each format answers well, and the three mistakes that show up most."
tags: ["twitter", "data", "json", "csv"]
canonical_url: https://digital-footprint-health.shop/blog/x-archive-csv-vs-json
Open an X archive and you get two families of files that look related and behave nothing alike.
One set is csv tables. The other set is js files that contain JSON and are not scripts at all. Pick the wrong one for a question and you either lose fields or reach a confident wrong answer, while assuming the data simply looks that way.
The difference that matters is not syntax. It is whether a format can express structure. CSV is a rectangle. JSON is a tree. Almost every mistake in this area traces back to asking a rectangle to hold a tree.
1. The real difference is whether structure can be expressed
The difference is whether structure can be expressed at all
CSV is two dimensional. It handles lists where every row is the same kind of record, and it cannot express hierarchy. JSON is a tree and the nesting is the feature rather than a detail. The gap shows up first in nested entities, where CSV flattens them into text or drops the field entirely, and that is not a flaw on the export side, it is what a flat format can hold.
2. Nested entities decide most of the arguments
The nested entities row is the one that decides most questions
A tweet with images can carry several size variants, a media type and the original link. In JSON those sit as children of the media object. In CSV they usually end up squeezed into a single field or left out altogether. So a count can match between the two formats while the content underneath is noticeably thinner, which reads like data loss and is not.
3. CSV answers anything you can phrase as count it or group it
CSV answers anything you can phrase as count it or group it
Anything you can phrase as count it or group it belongs in CSV. How many tweets in total, which year was heaviest, which posts contain a given word, what the language mix looks like, whether posting density in one period is unusual. Those take seconds in a spreadsheet, need no code, and go wrong rarely. CSV also lets you eyeball real rows, which is useful for confirming a filter does what you think.
4. JSON answers anything that walks down a structure
JSON answers anything that walks down a structure
Anything that walks down a structure belongs in JSON. Which tweet does this one reply to, which accounts were mentioned, what domain sits behind a shortened link, how many media files a single tweet carries. Those answers live in the hierarchy, and CSV flattens them on export. Mentioned accounts are a distinct field in JSON and a text blob in CSV, which is why mention counts done in a spreadsheet always run low.
5. Three mistakes, and the fix for the mismatch one
Three mistakes: CSV for relationships, JSON for counts, mismatch read as corruption
The js files catch people out because they look like code. They are not. X writes them as JSON wrapped in a leading assignment statement so the files can be read from a local drive without a server. Remove that line and standard JSON is left. That is also why double clicking tends to open nothing useful while a text editor shows everything.
Practical takeaways
- The difference is whether structure can be expressed at all
- The nested entities row is the one that decides most questions
- CSV answers anything you can phrase as count it or group it
- JSON answers anything that walks down a structure
- Three mistakes: CSV for relationships
Most people end up using both, which is the right answer. CSV for a fast pass over anything list shaped, JSON when the question involves a relationship. The two also cross check each other, and where they disagree it is usually one of the three explained causes rather than a broken export.
The longer version with the reference detail is here: https://digital-footprint-health.shop/blog/x-archive-csv-vs-json
Top comments (0)