vstakhov / libucl

Universal configuration library parser
BSD 2-Clause "Simplified" License
1.63k stars 139 forks source link

Parse error when including JSON #274

Open rickynils opened 1 year ago

rickynils commented 1 year ago

The following simple JSON file can't be included:

$ cat test.json 
{
    "key": "value"
}

$ cat top.ucl 
.include "./test.json"

$ ucl_tool -i top.ucl -f json
Failed to parse input file: .../test.json:3 object closed with } is not opened with { at line 1

If I remove the bottom brace from test.json, or both the top and bottom braces, it works:

$ cat test.json 
{
    "key": "value"

$ ucl_tool -i top.ucl -f json
{
    "key": "value"
}
$ cat test.json 
    "key": "value"

$ ucl_tool -i top.ucl -f json
{
    "key": "value"
}

I'm using libucl 0.8.2:

$ nix-store -qR `which ucl_tool` | grep libucl
/nix/store/ahcwqg33s5m9xj5s2iv6cbhwi3glxyds-libucl-0.8.2
rickynils commented 1 year ago

In version 0.8.1 I don't see this issue.