Opens in a new tab
Tutorial

Export After Effects Composition Data to JSON

Published November 13, 2026

You export After Effects composition data to JSON by writing a small ExtendScript that reads the composition and saves what it finds to a text file. Think of it as a short walk through the project, writing down each layer as you pass it. The script can be short, and much of the thinking happens before you write any of it, because the first decision is what “composition data” means for the job in front of you.

This page is for the person who needs that file for a reason beyond curiosity. You might be a developer who has to hand a template’s structure to a web app, a producer who wants a list of every editable layer before a batch is planned, or an agency lead trying to document a library of templates that nobody has opened in a year. We explain what you can pull out, how the script is shaped, where it can run, and how the result connects to Templater, which reads JSON in the other direction.

Decide what you are exporting before you write anything

After Effects holds an enormous amount of information about a composition. There is the basic frame, meaning name, width, height, frame rate and duration. There are the layers, each with a name, a type, an in point and an out point. There are properties on those layers, such as the text inside a text layer, a position, a scale or an opacity. There are effects, markers, expressions and the footage that each layer points at. If you tried to export all of it, you would get a very large file that is hard to read and harder to use. In practice a job only needs the few fields that answer its question.

So start with the question the file has to answer. Here is a typical scenario. A producer inherits a template with forty layers, and a dozen of them are meant to change from one video to the next: a headline, a customer name, a photo, a brand color, a sign-off line. Nobody wrote down which ones. The producer needs a clean list of the editable layers, with their names and types, so that a spreadsheet or a data feed can be built to match. That is a perfectly good reason to export to JSON, and the file it needs is small. One object for the composition, and an array of layer objects underneath, each carrying a name and a type and perhaps the current text.

Compare that with a developer who wants to draw a rough preview of the template in a browser. That person needs positions, sizes, in points and out points for every layer, because the browser has to place boxes on a canvas in the right order and at the right times. Same tool, same method, a much bigger set of fields. A third person, documenting an archive, may only want the composition name, its size, its length and the list of fonts and footage files it depends on. Three readers, three files. None of them needs the keyframes.

This is general practice and not a Dataclay feature, so we will be plain about it. The recommendation is to write the field list on paper first, then write the script to produce exactly that. A short field list gives you a script you can read in a single sitting, a file that opens without a fight, and an export that finishes in moments rather than minutes. You can always add a field later. Removing one from a script you have already handed to someone else is harder, because a downstream system may by then depend on it.

There is one useful shortcut if you already use Templater. Templater marks the layers that are meant to change by applying the Templater Settings effect to them, and it matches the layer name to a column header or to a JSON property key. Our documentation describes mapping in exactly those terms. That means the layers carrying the Templater Settings effect are, by definition, the editable ones, and their names are the keys. If your goal is a list of the dynamic layers, filter on that effect and ignore everything else. The list then doubles as the header row of a spreadsheet or the key names of a JSON data file.

Whatever you decide, put the decision in the file itself. A top-level field that records the project name, the composition name, the frame rate and the date of the export costs almost nothing. It saves the person who finds the file in six months from guessing which version of the template it describes. Templates change. A JSON file that cannot say which template it came from slowly turns into a source of arguments.

How the export script is shaped

The scripting language that After Effects uses is ExtendScript, an older dialect of JavaScript. Our documentation describes ExtendScript as the language for interacting with objects inside an After Effects project, including project assets, compositions, layers, keyframes and effect parameters. That is the full reach you need. Everything on your field list lives in one of those objects.

A typical export script has four steps, and it helps to know them by name even if you never write the code yourself.

First, the script finds the composition. In general practice this means asking After Effects for the item that is currently active in the project panel, or looking one up by name, and checking that it really is a composition before going any further. A script that skips this check will throw an error the first time someone runs it with a footage item selected. The friendliest version of the script shows a short message and stops.

Second, it walks the layers. A composition holds its layers in a numbered list, so the script counts through them from the first to the last. For each layer it reads the few properties you listed. The layer name and the in and out points come straight off the layer. The text of a text layer sits one level down, inside the Source Text property, and has to be read from there. Layers that are not text layers do not have it, so the script asks what kind of layer it is looking at before it reaches for text.

Third, it builds a plain structure in memory. This is a list of objects, one per layer, with fields that match your paper list exactly. Keep the values simple: strings, numbers, true and false, and nested lists. Do not try to store After Effects objects themselves, because they are live handles into the application and do not turn into text. Copy the values out.

Fourth, it turns that structure into JSON text and writes it to a file. Here is the first real trap. ExtendScript is old enough that, in general practice, you cannot count on a built-in JSON converter being there. One option is to include a small JSON helper file at the top of the script, and another is to build the text by hand with careful quoting. Both can work. Building it by hand is where bugs creep in, because a single unescaped quote inside a layer name, such as a name that contains a quotation mark, produces a file that no parser will read. If your layer names come from artists, assume they contain odd characters, and test with a layer named something awkward on purpose.

The second trap is the file itself. Our documentation states that JSON and tab-separated text files used as Templater data sources must be UTF-8 encoded so that international characters are read correctly. The same advice applies when you are the one writing the file. Set the encoding on the file object before you write, and open the result in a text editor that shows you the encoding. A layer whose name holds an accented letter or a non-Latin script is a good test. If the characters come back as question marks, fix the encoding before you send the file anywhere.

The third trap is duplicate names. After Effects does not stop you from naming three layers “Text”. In an export, three objects with the same name are fine as list items but ruinous as keys. If you plan to use layer names as JSON keys, which is what makes the file useful as a data skeleton, the script should detect a repeat and either stop with a clear message or add a suffix and report it. This is another place where a template that has been rigged for Templater is easier to work with. Mapping layers to data works by name, so a rigged template has layer names that someone has already had to choose deliberately.

Last, think about the output location. Writing to a fixed folder on someone’s desktop works for the person who wrote the script and fails for everyone else. A better habit is to write next to the project file, or to ask for a location when the script starts. If the script will run on a machine that nobody is sitting at, write to a folder you have named in the script and log a line saying where the file went.

Running it by hand, or at a set moment in a Templater run

There are two ordinary ways to run the script. The first is by hand. You choose it from the scripts menu in After Effects, it reads the active composition, it writes the file, and it is done. This is the right way for a one-time inventory or a template review, and it needs nothing from Dataclay at all.

The second is to attach it to a moment in a Templater run, and this is where it gets interesting for a pipeline. Templater broadcasts events as it works through a batch, and you can register an ExtendScript to run when a chosen event fires. Our documentation says event scripts are supported in Templater Bot, so this route belongs to automated setups. Inside such a script, Templater’s ExtendScript API hands you the composition it is working on through its target method, the job it is processing through its job methods, and a description of the output it is about to make or has just made. Registered after the layers are updated for a job, a script can record what each finished version of the composition looked like. Registered before, it can record the data that was about to go in. Both are useful for an audit trail, and neither needs you to open the project.

Two cautions come straight from our documentation. Templater runs registered event scripts on a preview by default, so a script that writes files will write one on every preview unless you tick the preference that prevents event scripts from running on preview, or have the script check how it was invoked and return early. And the same API methods return different things at different events. A call that asks for the current job has little to return at the moment the Bot is enabled, because no job exists yet. Match the question to the event. We cover the full list of events and the way registration works in our article on using ExtendScript with Templater events and job details, and the broader question of when you need an event script at all in our explainer on event scripts.

If the script writes a log line, you can read it later. Templater’s API includes methods for writing messages and errors to its own log files, which is a good place to note that an export ran and where it put the file. A script that fails without telling anyone is hard to trust. A script that logs one line per run is easy to trust.

Using the exported file, and what it will not do

Once you have a JSON file that describes a composition, there are three common destinations, and the third is where Templater comes in.

The first is documentation. A folder of small JSON files, one per template, gives a team something they can search, compare and keep under version control, in a way that a pile of project files cannot offer. When someone asks which templates contain a layer called “Price”, you can answer with a text search. This is a plain, unglamorous use, and for an agency with a large library it can pay for itself quickly.

The second is a hand-off to other software. A developer building a web preview, an approval tool or a form that collects content for a template needs to know what the template contains. The exported structure tells them the layer names, the types, and the order and timing. Because the file is plain text, it travels well between systems and languages.

The third is as a skeleton for a Templater data source. Our documentation describes a JSON data source as an array of objects in which each object is one render job and each property key matches a dynamic layer name, the same way a spreadsheet column header would. So an export of the dynamic layers gives you the key names for free. A producer can take that list, create one object with a value for every key, and then copy it a hundred times with different values. We describe the data file side of this in using a URL feed or JSON file as a Templater data source, and the step-by-step mapping in how to drive After Effects videos from JSON data. If you are unsure which kind of source suits your volume, our overview of data sources compares them.

One point deserves care here. The exported file describes the template. The data file feeds the template. They share key names, but they are not the same file, and a reader who confuses the two will paste a layer description into a data source and wonder why nothing renders. Name them differently. A suffix such as “structure” on one and “data” on the other is enough.

There is also a related feature that runs in the opposite direction, and it is worth knowing so you do not mistake it for an export. Templater can generate and import a special footage file called templater-data.json, and expression code can read values from it once the file is added to a composition as a layer. That is a way of feeding data into expressions. It is not a description of your composition, and our documentation marks it as experimental. We explain the trade-offs in using Templater data in After Effects expressions. Everything in that file arrives as a string, which is also worth remembering for your own exports. If a downstream system expects a number, decide whether your script writes it as a number or as text, and keep that choice the same on every field. Mixed types in one field are a likely cause of the mismatches we describe in our article on field type mismatches.

Where this approach stops

We want to be honest about the limits. Our documentation describes no Templater feature that exports a composition to JSON, and we are not going to claim one. What we describe is a script you write, running inside After Effects, using the scripting language the application provides. That has consequences.

A hand-written export is only as complete as the fields you chose. If you list five properties, you get five. It will not capture an effect you forgot, a custom expression on a property you did not read, or the contents of a nested composition unless you make the script go into it. Nested compositions deserve a decision of their own. A script that stops at the top level of the project will quietly miss anything that lives one level down, and a script that follows every nested composition can loop forever if two compositions refer to each other. Pick a depth, write it down, and make the script report when it stops.

It also does not rebuild the project. A JSON file describing a composition is a description, and turning that description back into a working After Effects project is a much bigger job than writing it out. If what you want is a round trip, where a developer edits the file and the project updates, then you are no longer looking at a short export script. You are looking at custom tooling, and for that kind of work it is reasonable to start with what you really need changed, because the need may be met by a data source and a rigged template instead.

And if all you need is a one-time list of the layers in one template, do not write a script at all. Select the layers, copy their names into a spreadsheet, and move on. A script earns its place when you will run it again, on many templates, or when a person other than you has to run it.

A worked example

Here is how the pieces fit for the producer with the forty-layer template. She wants a data source that a colleague can fill in. She decides the file only needs the composition’s name, frame rate and size, plus every layer that carries the Templater Settings effect, with its name and its type. That is her paper list.

She runs the export script by hand from the scripts menu. It checks that the active item is a composition, walks the forty layers, keeps the eleven that carry the effect, and writes a short JSON file next to the project, in UTF-8, with a line at the top giving the project name and the date. She opens the file and checks it in a text editor. Two layers are both called “Name”. The script had flagged them, so she renames one to “Name Subtitle” in the project and runs it again.

She now has eleven clean key names. She creates a data file with an array holding one object, fills in a value for every key, and previews it in Templater to see the headline, the photo and the sign-off land where she expected. Then her colleague duplicates the object for each customer, and the batch is ready for a spot check. Once written, the script can be run again on the next template by anyone on the team.

The bottom line

Exporting composition data to JSON is a scripting job, and it is a small one if you keep the field list short. Decide what the file has to answer, build a plain structure, mind the encoding and the duplicate names, and write down which template and date the file describes. Run it by hand for a one-time inventory. Attach it to a Templater event only if you want an audit trail from an automated run. If your real goal is to make many videos from one design, the file you need most is the data source, and the export is simply the quickest way to get its key names right. If your real goal is to rebuild projects from text, expect custom work, and talk to us about it.

That covers the method. Here are the questions people ask us before they build one of these scripts.

Frequently Asked Questions

Does After Effects have a built-in command to export composition data to JSON?

We are not aware of one, and our documentation describes no Templater feature that does it either. The route is an ExtendScript that reads the active composition and writes a text file. You can run it by hand from the scripts menu in After Effects, or register it to a Templater event if you run Templater Bot. Decide your field list first. A short list, such as composition name, frame rate, size and the name and type of each layer, gives you a file that is easy to read and quick to produce.

Which composition details are worth exporting?

Export only what the reader of the file needs. For a data source skeleton, that is the names and types of the layers that change from video to video. For a browser preview, add positions, sizes, in points and out points. For an archive, the composition name, size, length and the footage and fonts it depends on may be enough. Keyframes and expressions make the file large and hard to use, so leave them out unless a specific system needs them. You can always add a field later.

Can I use the exported JSON as a Templater data source?

Not as it comes. An export describes the template, while a Templater JSON data source is an array of objects in which each object is one render job and each key matches a dynamic layer name. The exported layer names are the useful part, because they give you the keys. Build a separate data file from them, fill in the values, and keep the two files named differently so nobody pastes one into the other.

Do I need Templater Bot to run an export script?

No. A script you run by hand from After Effects needs nothing from us. Event scripts, the kind Templater runs for you at a chosen moment in a batch, are supported in Templater Bot according to our documentation. Use that route only if you want an export to happen automatically during a run, for example to keep a record of each finished version. For a one-time inventory, running the script by hand is simpler.

Why does my exported JSON show question marks instead of special characters?

The file was most likely written in the wrong encoding. Our documentation says JSON files used as Templater data sources must be UTF-8 so international characters are read correctly, and the same rule is a good habit for your own exports. Set UTF-8 on the file object in the script before writing, then open the result in a text editor that shows the encoding. Test with a layer name that contains an accented letter.

What should I do about layers that share the same name?

Decide before you export. Three layers called Text are fine as items in a list but cannot serve as JSON keys, because each key has to be unique in an object. Have the script stop with a clear message, or add a suffix and report what it changed. The cleaner fix is to rename the layers in the project, which also helps if you later map those layers to data in Templater, since mapping works by layer name.

Leave the first comment

Sign up

Stay up to date with Datclay's newsletter. We won't spam your inbox.

Newsletter Signup
Name
Name
First
Last

By submitting your email, you agree to our Terms and Privacy Policy. You can opt out at any time.