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

Failed to parse environment file: json: cannot unmarshal number into Go struct field .value of type string #45

Open
juakaliCk opened this issue Jun 6, 2018 · 2 comments

Comments

@juakaliCk
Copy link

I can parse a collection fine using the following command--

postmanerator -output=./doc.html -collection=/var/www/[email protected]/config/postman_collection.json

this will show me a success message, however when i try and attach my corresponding environment variables, i get the following error:

postmanerator -output=./doc.html -collection=/var/www/[email protected]/config/postman_collection.json -environment=/var/www/[email protected]/config/postman_environment.json

Failed to parse environment file: json: cannot unmarshal number into Go struct field .value of type string

Upon inspection of the postman_environment.json file i have seen the few lines which are causing the issue by a process of elmination:

{
"key": "expires_in",
"value": 31536000,
"enabled": true,
"type": "text"
},

{
"key": "device_id",
"value": 22,
"enabled": true,
"type": "text"
},

It appears that upon inspecting a integer value which is labeled as a text type, postmanerator will read as a string. I can fix the issue by surrounding the value in quotes, however we wish to make the process of documentation automated. Thanks

@evasyuk
Copy link

evasyuk commented Dec 26, 2019

Facing the same issue:

Failed to parse environment file: json: cannot unmarshal number into Go struct field .value of type string

While having env file like this:

{
"id": "69227087-6753-4eef-8453-d5376c49358f",
"name": "server-development",
"values": [
{
"key": "URI",
"value": "https://some/v1",
"enabled": true
},
{
"key": "URI_V2",
"value": "https://some/v2",
"enabled": true
},
{
"key": "TEST_EMAIL",
"value": ""1{{$timestamp}}@2.com"",
"enabled": true
},
{
"key": "TEST_PASSWORD",
"value": ""1{{$timestamp}}@2.com"",
"enabled": true
},
{
"key": "MAGIC_KEY",
"value": """",
"enabled": true
},
{
"key": "FINGERPRINT",
"value": ""some"",
"enabled": true
},
{
"key": "TOKEN",
"value": "some.eyJ1c2VyX2lkIjozMjQsImZpbmdlcnByaW50IjoiXCJwb3N0bWFuXCIiLCJpYXQiOjE1Njg4OTcyNzQsImV4cCI6MTU2ODk1NzI3NH0.SYWHbwxP-MrGw_H4GC37wCI9Yh0E0Mqf4CGXdLw_fYs",
"enabled": true
},
{
"key": "TEST_EMAIL_2",
"value": ""[email protected]"",
"enabled": true
},
{
"key": "TEST_PASSWORD_2",
"value": ""[email protected]"",
"enabled": true
},
{
"key": "USER_1_ID",
"value": 336,
"enabled": true
},
{
"key": "USER_2_ID",
"value": "290",
"enabled": true
},
{
"key": "ROOM_ID",
"value": "1",
"enabled": true
},
{
"key": "MSG_ID_1",
"value": ""1"",
"enabled": true
},
{
"key": "MSG_ID_2",
"value": "",
"enabled": true
},
{
"key": "LOCATION_SEARCH",
"value": "{}",
"enabled": true
},
{
"key": "LOCATION_ID",
"value": "some:[email protected]",
"enabled": true
},
{
"key": "POST_ID",
"value": "53",
"enabled": true
},
{
"key": "TOKEN_2",
"value": "eoms.eyJ1c2VyX2lkIjozMTcsImZpbmdlcnByaW50IjoiXCJwb3N0bWFuXCIiLCJpYXQiOjE1NjgyMDA4NzcsImV4cCI6MTU2ODI2MDg3N30.cn7NxDy40IT0UA3V5Vy2DNaQocZnHh4nIhKpH6On5AU",
"enabled": true
},
{
"key": "MATCH_TO_INVITE",
"value": "",
"enabled": true
},
{
"key": "MATCHING_TIMEOUT",
"value": "12000",
"enabled": true
},
{
"key": "ARCHIVE_ID",
"value": "",
"enabled": true
},
{
"key": "PDF_URL",
"value": "https://some/v1/agreements/pdf/9i49879",
"enabled": true
},
{
"key": "SUBSTITUTE_ID",
"value": 300,
"enabled": true
},
{
"key": "TOKEN_3",
"value": "some.eyJ1c2VyX2lkIjozMzYsImZpbmdlcnByaW50IjoiXCJwb3N0bWFuXCIiLCJpYXQiOjE1NzI1OTg5NzUsImV4cCI6MTU3MjY1ODk3NX0.p8a7NRDRA_TkunqeSF4QBhNpNAE9RnRmdVu62r7sG6c",
"enabled": true
},
{
"key": "TEMP_OBJ",
"value": "{}",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2019-11-06T18:06:15.078Z",
"_postman_exported_using": "Postman/7.10.0"
}

@Sanix-Darker
Copy link

+1

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

3 participants