Created
December 21, 2021 00:10
-
-
Save blackhaj/6651f50c6755db63e25f09f5cb9fbcaf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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