1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 03:56:01 +01:00

Add support for stripping_comments from json. Update documentation of primop

This commit is contained in:
Farid Zakaria 2025-07-24 20:43:02 -07:00
parent d95ff93e70
commit 00921f6e3c
2 changed files with 4 additions and 1 deletions

View file

@ -204,7 +204,8 @@ public:
void parseJSON(EvalState & state, const std::string_view & s_, Value & v)
{
JSONSax parser(state, v);
bool res = json::sax_parse(s_, &parser);
bool res = json::sax_parse(
s_, &parser, nlohmann::detail::input_format_t::json, /* strict= */ true, /* ignore_comments= */ true);
if (!res)
throw JSONParseError("Invalid JSON Value");
}

View file

@ -2492,6 +2492,8 @@ static RegisterPrimOp primop_fromJSON({
```
returns the value `{ x = [ 1 2 3 ]; y = null; }`.
This function supports JSON with comments.
)",
.fun = prim_fromJSON,
});