0

Convert JavaScript Object to JSON String

by
Published Jun 6, 2022
Script helper Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 6 days ago
1
//native
2

3
// Set indented to true for pretty JSON.
4
export async function main(value: object, indented = false) {
5
  return JSON.stringify(value, null, indented ? 2 : null);
6
}
7

Other submissions
  • Submitted by jaller94 Deno
    Created 398 days ago
    1
    // Set indented to true for pretty JSON.
    2
    export async function main(value: object, indented = false) {
    3
      return JSON.stringify(value, null, indented ? 2 : null);
    4
    }
    5