0
Pretty Print JSON
One script reply has been approved by the moderators Verified
Created by rubenmestwet 912 days ago Viewed 72017 times
0
Submitted by jaller94 Deno
Verified 846 days ago
1
export async function main(value: object | string, indentation = 2) {
2
  if (typeof value === "string") {
3
    value = JSON.parse(value);
4
  }
5
  return JSON.stringify(value, null, indentation);
6
}
7