Skip to content

Instantly share code, notes, and snippets.

@blackhaj
Created December 21, 2021 00:10
Show Gist options
  • Select an option

  • Save blackhaj/6651f50c6755db63e25f09f5cb9fbcaf to your computer and use it in GitHub Desktop.

Select an option

Save blackhaj/6651f50c6755db63e25f09f5cb9fbcaf to your computer and use it in GitHub Desktop.
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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment