TubeToTranscript Logo
TubeToTranscript
Structured JSON Data

YouTube to JSON: Transcript Converter

Export a YouTube video’s transcript as clean, structured JSON, with timing for every caption line, ready for code, data analysis, or AI pipelines.

How to Export a YouTube Video to JSON

Get a video's captions as a JSON file in three steps. Free web access, with fair-use limits.

Step 1

Paste the YouTube Link

Paste a youtube.com, youtu.be, or Shorts link into the box above and get the transcript.

Step 2

Download as JSON

Open the Download menu above the transcript and choose JSON. The file is named after the video title.

Step 3

Load It in Your Code

Parse it with json.loads in Python or JSON.parse in JavaScript. Every segment carries its text, start, and duration.

Example: reading the file in Python and JavaScript

Once downloaded, the file needs no conversion step. These snippets print every caption line with its timestamp, and work on any file exported from this page:

# Python
import json

with open("video.json", encoding="utf-8") as f:
    data = json.load(f)

print(data["video"]["title"], data["total_segments"], "segments")
for seg in data["segments"]:
    print(seg["startFormatted"], seg["text"])
// Node.js
const fs = require("fs");
const data = JSON.parse(fs.readFileSync("video.json", "utf8"));

for (const seg of data.segments) {
  console.log(seg.startFormatted, seg.text);
}

To join the captions into one block of plain text, join the text field of every segment with spaces. To link to a moment, add &t= plus the whole-second value of start to the video’s youtube.com/watch?v= address.

The exact JSON shape

The file is a single object. It includes the video metadata (ID, title, channel), the caption language code, a total_segments count, and a segments array. Each segment has the caption text, start and duration in seconds (rounded to two decimals), and a human-readable startFormatted timestamp.

Sample JSON output (original example text, not from a real video)

{
  "video": {
    "videoId": "VIDEO_ID",
    "title": "Example Video Title",
    "channelName": "Example Channel"
  },
  "language": "en",
  "total_segments": 3,
  "segments": [
    {
      "text": "First, write down the question you want the video to answer.",
      "start": 0,
      "duration": 4,
      "startFormatted": "00:00"
    },
    {
      "text": "Next, search the transcript for a distinctive phrase.",
      "start": 4,
      "duration": 4.5,
      "startFormatted": "00:04"
    },
    {
      "text": "Finally, check the matching moment in the source video.",
      "start": 8.5,
      "duration": 5,
      "startFormatted": "00:08"
    }
  ]
}

Common ways developers use it

  • RAG and embeddings: chunk the segments array by time or word count and keep start with each chunk, so an answer can cite the moment it came from.
  • Search indexes: index text with start as a field to build “jump to where they said X” search over your own video library.
  • Subtitle tooling: start and duration map directly onto cue timing if you want to generate a custom subtitle format.
  • Analysis: load it with pandas (pd.json_normalize(data["segments"])) or JSON.parse in Node for word frequency, pacing, or topic analysis.

Notes on the timing fields

  • Times are seconds as numbers, not strings, so you can do arithmetic on them directly.
  • The end of a segment is start + duration. Caption tracks sometimes overlap slightly, so do not assume one segment ends exactly when the next begins.
  • For many videos at once, or to fetch programmatically, the REST API returns the same data without the download step.

Fetching JSON from code instead? See the YouTube transcript API guide for cURL, Python, and Node.js examples.

JSON Export FAQ

Find answers to common questions about generating and exporting YouTube transcripts.

The JSON contains video metadata (title, channel, videoId), language details, total segments, and an array of objects with text, start timestamp, duration, and formatted time.