使用可替换值解析 JSON
目前是否有任何语法允许在 .json 中替换值?
如果没有,我会建议拥有这种能力。 毕竟已经是 2022 年了,我们难道不应该能够轻松填充值而不必编写自己的解析器吗?
简单的例子:
{ "%h" : "某个值", 这
将用系统特定的主机名替换“%h”,并且如果“参数”不存在,则完全是选项,解析中不会发生任何变化。
如果 .json 具有特定的原生“参数”语法,那就没问题。 只是想法,我们可以有这个选项,“%h”或“”,无论 .json 想要什么语法。
Is there currently any syntax to allow for replaceable values in a .json ?
If not I would propose to have this capability.
After all this is 2022 shouldn't we be able to populate values easily without have to write our own parsers?
simple example:
{
"%h" : "some value",
}
this would replace "%h" with the system specific hostname, and would be completely option, if the "parameter" does not exist, no change in the parse.
And if .json has a specific "parameter" syntax that is native to them, that's fine.
Just the idea, we could have this option, "%h", or "", whatever syntax .json would like.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
JSON 标准不允许动态值。它是一种非常简单的文本表示格式,用于编码数据交换 标准出版物是这样描述的:
因此无法定义某种模板值。您可以通过单独处理 JSON 来实现此类功能,但这取决于您使用的技术堆栈和工具。但是,它仅适用于您的项目,不适用于任何其他第三方项目。
The JSON standard does not allow for dynamic values. It is a very simple text representation format meant for encoding data interchange the standard publcation describes it like this:
Therefore there is no way to define a template value of some sort. You can achieve such functionality by processing your JSON separately but that would depend on the technology stack and the tools you use. However, it would only work for your project, not in any other third party projects.