gpt4 book ai didi

c++ - 是否允许在 JSON 文件中对 boost read_json 进行注释?

转载 作者:行者123 更新时间:2023-11-30 02:23:31 27 4
gpt4 key购买 nike

这是我一直用来阅读boost::property_tree::json_parser::read_json的json文件的同伦

它始终有效。

/**********************************************/
/* the title */
/**********************************************/



{
"garden": {
"side1": {
"treeA1": "apple",
"treeA2": "orange",
"treeA3": "banana",
},
"side2": {
"treeB1": "orange",
"treeB2": "palm",
"treeB3": "cherry",
}
},
"house": ""
}

我将我的 boost 版本从 1.58.0 升级到 1.65.0,现在我收到了因为评论的异常。当我删除评论时,一切都很好。

是我哪里弄错了还是新版boost的bug?

最佳答案

评论不是 JSON。

旧的解析器确实有它们,但没有正确支持 unicode。

这是 the release notes for Boost 1.59.0 中的消息:

Property Tree:

  • A new JSON parser with full Unicode support.
  • Breakingchange: The new parser does not support comments or stringconcatenation in JSON files. These features were non-standardextensions of the old parser but their removal could break code whichwas relying on them.

关于c++ - 是否允许在 JSON 文件中对 boost read_json 进行注释?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46187201/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com