Skip to main content
SubtitleMatrix

SMI to JSON

Or paste subtitle text

What this conversion changes

1 thing is dropped or needs a decision

  • Format-specific content

    content the source format keeps outside its cues (non-cue blocks, header text, per-cue settings, commented-out events) — the target format has no place for it

This list comes from the capability matrix for these two formats, not from the particular file you loaded. A specific file may lose more if it uses features the format allows but the matrix does not model.

This page converts SMI to JSON. Drop a file in — or paste the text — and you get the JSON version back. The conversion runs entirely in your browser, so nothing is uploaded and no account is needed.

These two formats do not store the same things, and the difference is not cosmetic: format-specific content has nowhere to go in JSON. The list above comes from what the two formats can each express rather than from your file, so it is the same answer before you load anything.

One file is fine, and so is a whole season: the queue works through them in order and the results come down together as a single ZIP.

Examples

A typical SMI file, converted to JSON

Input

<SAMI>
<HEAD>
<STYLE TYPE="text/css">
<!--
P { text-align: center; font-family: Arial; }
.ENCC { Name: English; lang: en-US; }
-->
</STYLE>
</HEAD>
<BODY>
<SYNC Start=1000>
<P Class=ENCC>Hello there.
<SYNC Start=3000>
<P Class=ENCC>&nbsp;
<SYNC Start=3500>
<P Class=ENCC>How are you?<br>Fine, thanks.
<SYNC Start=6000>
<P Class=ENCC>&nbsp;
</BODY>
</SAMI>

Output

{
  "version": 1,
  "cues": [
    {
      "start": 1000,
      "end": 3000,
      "lines": [
        "Hello there."
      ]
    },
    {
      "start": 3500,
      "end": 6000,
      "lines": [
        "How are you?",
        "Fine, thanks."
      ]
    }
  ]
}

Dropped in this output: format-specific content. Everything else matches line for line.

The same conversion on an awkward input

Input

<SAMI>
<HEAD>
<TITLE>Episode 1</TITLE>
<STYLE TYPE="text/css">
<!--
.ENCC { Name: English; }
-->
</STYLE>
</HEAD>
<BODY>
<sync start="00:00:02,500">
<P Class=ENCC>Line one<br>Line two
<sync start=9000>
<P Class=ENCC>Tom &amp; Jerry
<SYNC Start=12000>
<P Class=ENCC>&nbsp;
</BODY>
</SAMI>

Output

{
  "version": 1,
  "cues": [
    {
      "start": 2500,
      "end": 9000,
      "lines": [
        "Line one",
        "Line two"
      ]
    },
    {
      "start": 9000,
      "end": 12000,
      "lines": [
        "Tom &amp; Jerry"
      ]
    }
  ]
}

This is the kind of damage real files have — mixed line endings, stray whitespace, fields left empty. Compare it with the tidy example above to see what the parser forgives.

Frequently asked questions

What happens to SAMI's `<STYLE>` block, `<TITLE>` and `Class=` attributes in JSON?

They are dropped, though on this one direction it is worth being precise: the JSON output does have a `title` key and a `styles` object, and both come out empty, because nothing maps SAMI's CSS or its title onto them. Emphasis written inside a cue's own text is a different matter — that belongs to the line and arrives in the `tags` array. What goes is everything the file kept outside its cues: a `<STYLE>` block of CSS for the paragraphs, a `<TITLE>`, and the channel marker each paragraph carries — `Class=ENCC`, which points at one of those rules.

What does the output look like when SMI becomes JSON?

Like JSON: an array of cue objects, each with its own `id`, `start` and `end`. Every SMI cue becomes one JSON cue, in the same order, with the same text.

Are the SMI timings exact in the JSON file?

Yes, to the millisecond — which is as fine as either format goes. SMI writes a moment as `Start=4126` and JSON writes the same moment as `4126`; nothing is rounded or shifted between the two, and a cue that was on screen for 2.9 seconds still is.

How does a two-line SMI cue come out in JSON?

As two entries in the cue's `lines` array. The pairing survives — the two SMI lines still belong to one subtitle in the JSON output, and a player shows them together.

Do SMI cues keep their order in the JSON output?

Yes, and they are sorted by start time on the way — earliest first, which is how every format here expects them and how players read them. If your SMI file listed its cues out of sequence, the JSON output puts them back in order; that is a change to the file's structure rather than its content, and it is deliberate.

Can I convert the JSON back to SMI?

Yes, and it has its own list: converting JSON to SMI drops styling and karaoke. That list is different from the one above because the two formats keep different things.

Does the JSON output keep the SMI file's encoding?

No — the output is UTF-8, with Unix line endings and no byte-order mark, whatever the SMI file used. A file that arrives in UTF-16, or in a Windows single-byte encoding, is decoded on the way in (the result panel says so when that happens); what comes out is always the same UTF-8 JSON.

Related tools