DevTools Logo

Lottie JSON Tweaker

Lottie JSON Tweaker

Preview Lottie animations, check their basic structure and adjust fill and stroke colors in your browser.

Runs in your browser
Try an example

Lottie JSON

62 lines · 1,080 chars

Layers (1)

Sample shapety: 4

Preview & colors

Color edits are stored as 8-bit values (n/255), so a picked color can differ slightly from the original float. Unedited colors and unknown fields are kept exactly.
1.0×

Colors (1)

layers[0].shapes[0].it[1].c.kalpha 1 kept

Uses a lazy-loaded lottie-web preview and a deterministic client-side parser. Only assets.colors and layer k RGB arrays are editable.

Examples

Scoped color discovery

Input
parseLottieJson(source).colors
Output
[{ assets[0].colors[0] }, { layers[0].c.k }, { layers[0].nested.k }]

Only asset colors and layer k RGB arrays surface; metadata k is excluded.

Hex swap plus round-trip

Input
replaceLottieColor(parsed, "layers[0].c.k", hexToLottieColor("#ff0080"))
Output
{ layers[0].c.k: [1, 0, 0.5…], serialized via serializeLottie }

The hex converts to 0-1 channels, replaces one path, and serializes back.

About this tool

Lottie JSON Tweaker edits animations with parseLottieJson(input), replaceLottieColor(document, path, color), and serializeLottie(document): the JSON deep-clones through structuredClone, color entries collect as { path, value } triples, and layers list as { path, ty, nm } entries.

Color discovery is scoped: arrays under assets colors collect every RGB triple while layers collect only k arrays holding three 0-1 channels — so layers[0].c.k qualifies but metadata k and freeform notes arrays stay untouched.

Layers resolve ty and nm with fallbacks: missing names become Layer N and non-numeric ty becomes null, while helpers lottieColorToHex and hexToLottieColor convert six-digit hex both ways and canRenderLottie gates the browser-only preview off in SSR and jsdom.

How to use this tool

  1. Paste Lottie JSON

    Provide the animation object with assets, layers, and color arrays.

  2. Pick a color path

    Choose a discovered entry like layers[0].c.k from the color list.

  3. Replace the color

    Apply an RGB triple or six-digit hex to that path only.

  4. Export JSON

    Copy the deterministically serialized animation for playback.

Use cases

Recoloring animations

Swap brand colors across asset palettes and layer fills by path.

Auditing layer structure

List ty and nm entries to map shape versus precomp layers.

Validating uploads

Catch malformed JSON and out-of-range channels with explicit errors.

Common mistakes

Mistake:Editing metadata k and expecting a color entry.

Fix:Only assets colors and layer k arrays are color paths — other triples throw a color-path error.

Mistake:Passing channels outside 0-1.

Fix:Lottie channels are normalized floats, so divide 0-255 values by 255 first.

Mistake:Pasting shorthand or eight-digit hex.

Fix:hexToLottieColor requires six digits — expand #f08 to #ff0088 before converting.

Frequently asked questions

What does this tool do?

It parses Lottie JSON into a cloned document with discovered color paths and a ty/nm layer list, replaces one color path at a time, and serializes the animation back deterministically.

Which arrays count as colors?

Arrays under assets colors plus layer k triples with 0-1 channels qualify — metadata k and freeform triples are excluded and throw a color-path error if edited.

Is my animation uploaded or stored?

No. Parsing, color replacement, hex conversion, and serialization run entirely in your browser.

Why an invalid JSON or hex error?

Malformed or non-object JSON throws Invalid Lottie JSON, channels outside 0-1 are rejected, and hex input must be six digits like #ff0080.

References & standards