Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

256 B
Raw Blame
import { format, applyEdits } from "jsonc-parser"

export function prettifyJSONC(str: string) {
  const editResult = format(str, undefined, {
    insertSpaces: true,
    tabSize: 2,
    insertFinalNewline: true,
  })
  return applyEdits(str, editResult)
}