You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to use reflect-cpp to parse a config, so ideally json with comments (jsonc) would be supported with a processor like rfl::Comments or rfl::JsonC
I think the format is a pretty simple extension of json, we would just need to filter out the comments before parsing. https://github.com/Microsoft/node-jsonc-parser is the impl I'm referencing. I see actually there's a yyjson flag called YYJSON_READ_ALLOW_COMMENTS, so maybe this would be pretty simple to support.
Activity
liuzicheng1987 commentedon Apr 13, 2025
Hi @AndrewNolte ,
do you know a good C/C++ library for the json format that we could wrap?
AndrewNolte commentedon Apr 18, 2025
I think the format is a pretty simple extension of json, we would just need to filter out the comments before parsing. https://github.com/Microsoft/node-jsonc-parser is the impl I'm referencing. I see actually there's a yyjson flag called YYJSON_READ_ALLOW_COMMENTS, so maybe this would be pretty simple to support.
liuzicheng1987 commentedon Apr 19, 2025
@AndrewNolte I like the idea of just using the YYJSON flag.
Altren commentedon May 1, 2025
In fact this is possible since 0.18 release:
rfl::json::load<T>(fileName, YYJSON_READ_ALLOW_COMMENTS)AndrewNolte commentedon May 2, 2025
Awesome thanks! Here's a PR to add flag passing to the other json read() method- #425
liuzicheng1987 commentedon May 6, 2025
Can we close this issue? @Altren @AndrewNolte
Altren commentedon May 6, 2025
Yes, it is all there now
AndrewNolte commentedon May 9, 2025
Yep thanks!