我能否在以下发言中发表一些意见?Json Json (Json Json) (Json Json Json) (Json Json) Json Json (Json Json) Json (Json) Json (Json) Json (Json) Json (Json) Json (Json) Json (Json) Json(Json) Json (Json) Json (Json) Json(Json) Json (Json) Json如果有,如何处理?
当前回答
其他回答
正如许多答复已经指出的,JSON在本地没有评论。当然,有时你还是想要评论。Python 符号,两个方法commentjson
(#
和//
仅用于 Python 2 的)或json_tricks
(#
或//
Python 2 和 Python 3 的 Python 2 和 Python 3, 具有其他几个特点。json_tricks
.
免责声明:这太愚蠢了
事实上,有一种方法可以添加评论,并且不超出规格(不需要额外的分析师 ) 。 它不会在不作任何区分的情况下产生人类可读的评论。
您可滥用下列手段:
任何标志之前或之后都允许不显眼的白色空间。 白色空间是下列一个或多个代码点的任何序列: 字符制表( U+0009)、 线性种子( U+000A)、 运输返回( U+000D) 和空间( U+0020)。
黑客方式, 您可以滥用此选项添加注释 。 例如 : 开始并用标签结束您的评论 。 在 base 3 中编码该注释, 并使用其他空白字符来代表它们 。 例如 。
010212 010202 011000 011000 011010 001012 010122 010121 011021 010202 001012 011022 010212 011020 010202 010202
(hello base three
在ASCII)中,但使用空间不是0,而是用于1条线路饲料和2条运输回程。
这将留给您许多无法读取的空白( 除非您用 IDE 插件来编码/ 解码在苍蝇上) 。
我从来没有尝试过这个, 原因很明显,你也不应该。
如果您的文本文件, 即 JSON 字符串, 将会被某个程序读取, 使用 C 或 C++ 样式之前要删除 C 或 C+ 样式的注释会有多困难 ?
答复:这将是一个班轮。 如果您这样做, JSON 文件可以用作配置文件 。
虽然JSON不支持评论,杰森确实如此。
使用“.jsonc”扩展名命名您的文件并使用jjsonc 喷气管解剖师
如果回答为时已晚, 抱歉 。
jsonWithComments.jsonc
示例:
{
// This is a comment!
"something": "idk"
}
如果情况不明,我认为机器人是怪异的。请在投票之前先试一下,因为这个问题没有帮助。
JSON本身不允许评论。 推理是完全愚蠢的, 因为你可以使用JSON。本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身提出评论,完全排除推理,和在完全没有正当理由的情况下装入解析器数据空间精确同一结果和潜在问题,如:JSON档案,附有评论。
如果您试图在(使用)
//
或/* */
或#
举例说 ) , 那么有些分析师会失败, 因为这严格地说不在JSON 的规格之内。 所以您应该从未这样做。
例如,这里,这里,这里,这里,我的图像处理系统已保存图像标记和一些基本格式化(注释)信息( 在底部) :
{
"Notations": [
{
"anchorX": 333,
"anchorY": 265,
"areaMode": "Ellipse",
"extentX": 356,
"extentY": 294,
"opacity": 0.5,
"text": "Elliptical area on top",
"textX": 333,
"textY": 265,
"title": "Notation 1"
},
{
"anchorX": 87,
"anchorY": 385,
"areaMode": "Rectangle",
"extentX": 109,
"extentY": 412,
"opacity": 0.5,
"text": "Rect area\non bottom",
"textX": 98,
"textY": 385,
"title": "Notation 2"
},
{
"anchorX": 69,
"anchorY": 104,
"areaMode": "Polygon",
"extentX": 102,
"extentY": 136,
"opacity": 0.5,
"pointList": [
{
"i": 0,
"x": 83,
"y": 104
},
{
"i": 1,
"x": 69,
"y": 136
},
{
"i": 2,
"x": 102,
"y": 132
},
{
"i": 3,
"x": 83,
"y": 104
}
],
"text": "Simple polygon",
"textX": 85,
"textY": 104,
"title": "Notation 3"
}
],
"imageXW": 512,
"imageYW": 512,
"imageName": "lena_std.ato",
"tinyDocs": {
"c01": "JSON image notation data:",
"c02": "-------------------------",
"c03": "",
"c04": "This data contains image notations and related area",
"c05": "selection information that provides a means for an",
"c06": "image gallery to display notations with elliptical,",
"c07": "rectangular, polygonal or freehand area indications",
"c08": "over an image displayed to a gallery visitor.",
"c09": "",
"c10": "X and Y positions are all in image space. The image",
"c11": "resolution is given as imageXW and imageYW, which",
"c12": "you use to scale the notation areas to their proper",
"c13": "locations and sizes for your display of the image,",
"c14": "regardless of scale.",
"c15": "",
"c16": "For Ellipses, anchor is the center of the ellipse,",
"c17": "and the extents are the X and Y radii respectively.",
"c18": "",
"c19": "For Rectangles, the anchor is the top left and the",
"c20": "extents are the bottom right.",
"c21": "",
"c22": "For Freehand and Polygon area modes, the pointList",
"c23": "contains a series of numbered XY points. If the area",
"c24": "is closed, the last point will be the same as the",
"c25": "first, so all you have to be concerned with is drawing",
"c26": "lines between the points in the list. Anchor and extent",
"c27": "are set to the top left and bottom right of the indicated",
"c28": "region, and can be used as a simplistic rectangular",
"c29": "detect for the mouse hover position over these types",
"c30": "of areas.",
"c31": "",
"c32": "The textx and texty positions provide basic positioning",
"c33": "information to help you locate the text information",
"c34": "in a reasonable location associated with the area",
"c35": "indication.",
"c36": "",
"c37": "Opacity is a value between 0 and 1, where .5 represents",
"c38": "a 50% opaque backdrop and 1.0 represents a fully opaque",
"c39": "backdrop. Recommendation is that regions be drawn",
"c40": "only if the user hovers the pointer over the image,",
"c41": "and that the text associated with the regions be drawn",
"c42": "only if the user hovers the pointer over the indicated",
"c43": "region."
}
}
推荐文章
- 如何合并2 JSON对象从2个文件使用jq?
- 在VS Code中禁用“Comments are not allowed In JSON”错误
- 如何在Kotlin解析JSON ?
- JSON文件的蒙古导入
- 如何用jQuery / JavaScript解析JSON数据?
- jQuery在请求体中发布有效的json
- 将JSON显示为HTML
- Swift:理解// MARK
- 在JSON键名中哪些字符是有效的/无效的?
- 如何JSON序列化集?
- 如何检查JSON键是否存在?
- 在构建中编写注释的语法是什么?gradle文件?
- 将对象序列化为JSON
- node.js TypeError:路径必须是绝对路径或指定根路径到res.sendFile[解析JSON失败]
- Python json。loads显示ValueError:额外数据