libucl icon indicating copy to clipboard operation
libucl copied to clipboard

Parse error when including JSON

Open rickynils opened this issue 2 years ago • 1 comments

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 avatar Oct 03 '23 21:10 rickynils

In version 0.8.1 I don't see this issue.

rickynils avatar Oct 03 '23 22:10 rickynils