Hey folks - I made a little JSON formatter (my first attempt at a script)

It does the following:

Grabs the latest item on your clipboard Formats it using prettier (this will have to install on your first time running the script) Copies the formatted JSON to your clipboard Super simple but hopefully useful.

Open json-formatter in Script Kit

import '@johnlindquist/kit';
const prettier = await npm('prettier');
// Name: json-formatter
// Author: Henry Black
// Twitter: @hajblack
const unformattedJson = await paste();
let result;
try {
result = await prettier.format(unformattedJson, {
parser: 'json',
});
await copy(result);
} catch (err) {
arg("Couldn't format that string: " + err);
}

Any feedback very welcome - this is my first script on ScriptKit so I would love any pointers.