Copy As Minified JSON

Copy As Minified JSON

Build a script to copy as minified JSON.

Getting Started

Create a script file in the script folder with the following code.

This example also includes a keyboard shortcut ⌥ ⌘ m.

@okjson.schemaVersion 1 Copy As Minified JSON
@okjson.description Copied input string as minified JSON.
@okjson.keyboardShortcut ⌥⌘m
@okjson.openResultInNewWindow no OK JSON
function main(obj) {
  let result = JSON.stringify(obj);
  $'Copied As Minified JSON', 'Length: ' + result.length);
  return result;

Example JSON String for Testing

  "name": "OK JSON",
  "version": "2.0.0",
  "platform": "macOS"