Script Kit Logo
Script Kit
by John Lindquist
Community ScriptsDocsGuideDiscussBlog
Henry Black
Scripts /

Henry Black

HAJBlack

a-simple-json-formatter

by Henry Black
InstallAdd to Kit.app
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);
}
created by
John Lindquist
GitHub