Visual Studio Code使用什么JSON格式化程序来格式化JSON?

huangapple go评论65阅读模式
英文:

What JSON formatter does Visual Studio Code use to format JSON?

问题

  1. Visual Studio Code内置了JSON工具,包括一个格式化程序:https://code.visualstudio.com/docs/languages/json#_formatting

  2. 它是否可用作Visual Studio Code之外的命令行工具?

  3. 它与 jq 有什么不同?

英文:

Visual Studio Code has built-in JSON tools, including a formatter: https://code.visualstudio.com/docs/languages/json#_formatting

  1. What underlying JSON formatter does Visual Studio Code use?
  2. Is it available to use as a command line tool outside of Visual Studio Code?
  3. How does it differ from jq?

答案1

得分: 1

以下是翻译的内容:

这是查找你要找的信息的方法:

所以来回答你的问题:

> 1. Visual Studio Code 使用什么底层的 JSON 格式化程序?

https://www.npmjs.com/package/jsonc-parser

> 2. 它可以作为 Visual Studio Code 之外的命令行工具使用吗?

可以。以与 microsoft/vscode-json-languageservice 使用它相同的方式使用它。将其添加为 JS 项目的依赖,就像你会依赖于任何其他 NPM 包一样。

> 3. 它与 jq 有什么不同?https://stedolan.github.io/jq/

首先,它支持带注释的 JSON,而 jq 不支持(参见 https://github.com/stedolan/jq/wiki/FAQ#processing-not-quite-valid-jsonhttps://stackoverflow.com/q/33352930/11107541)。

英文:

Here's how to find the info you're looking for

So to answer your questions:

> 1. What underlying JSON formatter does Visual Studio Code use?

https://www.npmjs.com/package/jsonc-parser

> 2. Is it available to use as a command line tool outside of Visual Studio Code?

Yes. Use it in the same way that microsoft/vscode-json-languageservice uses it. Add it as a dependency of a JS project in the same way you'd depend on any other NPM package.

> 3. How does it differ from jq? https://stedolan.github.io/jq/

Well, for one thing, it supports JSON with comments, which jq doesn't (see https://github.com/stedolan/jq/wiki/FAQ#processing-not-quite-valid-json and https://stackoverflow.com/q/33352930/11107541).

huangapple
  • 本文由 发表于 2023年4月20日 00:34:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/76056894.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定