格式化 JSON 字符串
值
formatJSON({ a: 123, b: 456 }); /// '{\n "a": 123,\n "b": 456\n}'formatJSON('123'); /// '"123"'formatJSON(123); /// '123'formatJSON(null); /// 'null'formatJSON(true); /// 'true'formatJSON(undefined); /// 'undefined'formatJSON(new Date()); /// '"2023-03-02T10:02:42.019Z"' Copy
formatJSON({ a: 123, b: 456 }); /// '{\n "a": 123,\n "b": 456\n}'formatJSON('123'); /// '"123"'formatJSON(123); /// '123'formatJSON(null); /// 'null'formatJSON(true); /// 'true'formatJSON(undefined); /// 'undefined'formatJSON(new Date()); /// '"2023-03-02T10:02:42.019Z"'
格式化 JSON 字符串