Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require(file.json) returns a string with spaces as an array #1852

Open
Pixelherz23 opened this issue Nov 8, 2023 · 0 comments
Open

require(file.json) returns a string with spaces as an array #1852

Pixelherz23 opened this issue Nov 8, 2023 · 0 comments

Comments

@Pixelherz23
Copy link

Pixelherz23 commented Nov 8, 2023

I have this json file:

{
"id": "bar",
"name": "foo",
"values": [
    {
        "key": "Scope",
        "value": "A string with spaces",
        "enabled": true
    }
]
}

When I try to access it:

const postmanEnv = require('./postman_env.json');
console.log(postmanEnv.values[0]);

It returns:

 {
  key: 'Scope',
  value: [
    'A',
    'string',
    'with',
    'spaces'
  ],
  enabled: true
}

Expected behavior:

{
 key: 'Scope',
 value: 'A string with spaces',
 enabled: true
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant