JSON parse on ubuntu

Hello, I have run into a problem parsing from JSON on ubuntu.
I have a script to which I pass a .json file through an env variable as such k6 run --env MY_CONFIG_FILE=var.json pisp_car_test.js.
Within the code it is used as such const variables = JSON.parse(open(__ENV.MY_CONFIG_FILE));
The content of a file is quite simply a small json object:

{
"baseURL": "https://sandbox-url.domain.eu/path/",
"clientId": "value",
"clientSecret": "secretValue"
}

On my mac, it works perfectly. On my remote ubuntu server I receive the following:
ERRO[0002] cannot parse json due to an error at line 1, character 2 , error: invalid character ‘e’ looking for beginning of value
contactsat reflect.methodValueCall (native)
at main (file:///home/ubuntu/k6-stress-tests/performance_tests/pisp_car_test.js:72:12(52)) executor=constant-arrival-rate scenario=contacts source=stacktrace

I can vouch for same file contents.
Perhaps somebody has faced the issue and has a workaround?

Hi @ViktorNedelko

Welcome to the forum. The following works for me:

const variables = JSON.parse(open(__ENV.MY_CONFIG_FILE));

export default function () {
    console.log(JSON.stringify(variables));
}

I’m also on Ubuntu ATM so there must be some other factor at play here :confused: Have you tried other things, like passing a string to JSON.Parse or just dumping the file contents to console without parsing ?

That was actually my mistake, this parse works for me and it turns out the error was thrown by another one a tad later, which I missed.
Thank you tho.