TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why JSON doesn't support comments

6 点作者 talles将近 9 年前

1 comment

mcherm将近 9 年前
&gt; Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser.<p>Excellent advice... except that it isn&#x27;t built that way. The tool <i>that someone else built</i> reads a JSON configuration file instead of a &quot;JSON-after-running-through-JSMin&quot; file. I can&#x27;t change that. So I either have to build some complex deployment tool that reads config files from somewhere else then copies them over (piping through JSMin) to the server to be executed, OR ban comments. And the second one is much simpler.