Skip to content

Harden AppleScript JSON output #2

@frouaix

Description

@frouaix

Summary

Move JSON serialization from AppleScript string concatenation to the Swift layer to handle special characters robustly.

Details

Currently, AppleScript templates build JSON output via string concatenation, which is fragile when values contain:

  • Quotes (")
  • Backslashes (\)
  • Newlines (\n)
  • Other special characters

The fix is to move JSON serialization into the Swift executor layer (e.g., using JSONSerialization or Codable), where proper escaping is handled natively.

Affected files

  • packages/executor-swift/Sources/Executor/*Templates.swift (10 app template files)
  • Possibly packages/executor-swift/Sources/Executor/JsonIO.swift

From TODO.md

Harden AppleScript JSON output — Move JSON serialization from AppleScript string concatenation to the Swift layer to handle special characters (quotes, backslashes, newlines) robustly

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions