小编Chr*_*ett的帖子

clang 格式化 json 文件

我有一个 json 文件。如果我在其上运行 clang-format ,它会将其格式化为代码(丑陋)。

{
  "name" : "My great app",
           "description" : "It's really cool.",
                           "version" : "0.0.1"
}
Run Code Online (Sandbox Code Playgroud)

如果我将 'foo = ' 放在文件的开头,那很好,但它不再是 json 了。

foo = {
  "name" : "My great app",
  "description" : "It's really cool.",
  "version" : "0.0.1"
}
Run Code Online (Sandbox Code Playgroud)

如何获得 clang-format 来格式化 json 文件中的裸对象,如第二个示例所示?

javascript json clang-format

5
推荐指数
1
解决办法
3890
查看次数

标签 统计

clang-format ×1

javascript ×1

json ×1