JSON Import

Import canvas data from previously exported JSON files. This is useful for loading saved artwork, sharing projects, or restoring backups.


What JSON Import Preserves

When importing a JSON file, the following data is restored:

  • Cell data - Characters, text colors, and background colors
  • Cell positions - Exact X/Y coordinates on the canvas
  • Animation frames - If the JSON was exported with animation data

What JSON Import Does NOT Preserve

  • Canvas dimensions (uses current canvas size)
  • Custom character palettes
  • Custom color palettes
  • Project settings
  • Undo/redo history
Info

For full project preservation including palettes and settings, use Session files (.asciimtn) instead.


How to Import JSON

  1. Click Import in the top toolbar
  2. Select JSON Data from the dropdown
  3. A dialog appears with two options:
    • Paste JSON - Paste JSON data directly into a text area
    • Upload File - Select a .json file from your computer
  4. Click Import to load the data

JSON Format

ASCII Motion exports JSON in a structured format:

Single Frame

json
{
  "version": "1.0",
  "width": 80,
  "height": 24,
  "cells": [
    {
      "x": 0,
      "y": 0,
      "char": "@",
      "color": "#FFFFFF",
      "bgColor": "transparent"
    },
    {
      "x": 1,
      "y": 0,
      "char": "#",
      "color": "#FF0000",
      "bgColor": "#000000"
    }
  ]
}

Animation (Multiple Frames)

json
{
  "version": "1.0",
  "width": 80,
  "height": 24,
  "frameCount": 3,
  "frameRate": 12,
  "frames": [
    {
      "index": 0,
      "duration": 83,
      "cells": [...]
    },
    {
      "index": 1,
      "duration": 83,
      "cells": [...]
    }
  ]
}

Cell Data Structure

Each cell in the JSON contains:

FieldTypeDescription
xnumberHorizontal position (0 = leftmost)
ynumberVertical position (0 = topmost)
charstringSingle character
colorstringText color (hex format)
bgColorstringBackground color (hex or "transparent")

Import Behavior

Canvas Size Handling

If the imported content dimensions differ from your current canvas:

  • Content larger than the canvas is cropped to fit
  • Content smaller than the canvas appears top-left aligned
  • Cells outside canvas bounds are discarded

Overwrite vs Merge

JSON import replaces the current frame content. Existing cells are cleared before importing.

Warning

JSON import is not undoable in a single step. Save your work or export before importing if you want to preserve your current state.


Troubleshooting

"Invalid JSON format"

The file doesn't contain valid JSON. Check for:

  • Missing commas between objects
  • Unclosed brackets or braces
  • Invalid characters

"Missing required fields"

The JSON is valid but doesn't have the expected structure. Ensure it contains:

  • cells array (for single frame) or frames array (for animation)
  • Each cell has x, y, char, and color properties

Content appears truncated

Check if the JSON width and height match your canvas dimensions. Resize your canvas if needed before importing.


Use Cases

Sharing Artwork

Export your work as JSON and share the file. Others can import it into their ASCII Motion instance.

Version Control

JSON files are text-based and work well with version control systems like Git. Store your ASCII art in a repository.

Automated Generation

Create JSON programmatically using scripts or other tools, then import into ASCII Motion for visualization and editing.

Backup and Restore

Export JSON as a lightweight backup format. Import later to continue working.