diff --git a/tools/postman/scripts/transform-for-api.sh b/tools/postman/scripts/transform-for-api.sh index 7e08a60f7b..9d0eab4f41 100755 --- a/tools/postman/scripts/transform-for-api.sh +++ b/tools/postman/scripts/transform-for-api.sh @@ -125,17 +125,21 @@ else cp intermediateCollectionPostBody.json "$COLLECTION_TRANSFORMED_FILE_NAME" fi +# Remove trailing whitespaces by reformatting the JSON +echo "Removing all whitespaces from the final JSON file" +jq -c '.' "$COLLECTION_TRANSFORMED_FILE_NAME" > tmpnowhitespaces.json && mv tmpnowhitespaces.json "$COLLECTION_TRANSFORMED_FILE_NAME" + # Clean up temporary files echo "Removing temporary files" rm intermediateCollectionWrapped.json \ - intermediateCollectionDisableQueryParam.json \ - intermediateCollectionNoPostmanID.json \ - intermediateCollectionNoCircular.json \ - intermediateCollectionWithName.json \ - intermediateCollectionWithDescription.json \ - intermediateCollectionWithBaseURL.json \ - intermediateCollectionWithLinks.json \ - intermediateCollectionPostBody.json \ - intermediateCollectionWithNoVar.json + intermediateCollectionDisableQueryParam.json \ + intermediateCollectionNoPostmanID.json \ + intermediateCollectionNoCircular.json \ + intermediateCollectionWithName.json \ + intermediateCollectionWithDescription.json \ + intermediateCollectionWithBaseURL.json \ + intermediateCollectionWithLinks.json \ + intermediateCollectionPostBody.json \ + intermediateCollectionWithNoVar.json popd -0 diff --git a/tools/postman/scripts/transform-postman.js b/tools/postman/scripts/transform-postman.js index 453cbbeb0a..a88f090970 100644 --- a/tools/postman/scripts/transform-postman.js +++ b/tools/postman/scripts/transform-postman.js @@ -119,7 +119,7 @@ function loadJsonFile(filePath) { } function saveJsonFile(filePath, json) { - fs.writeFileSync(filePath, JSON.stringify(json, null, 2), 'utf8'); + fs.writeFileSync(filePath, JSON.stringify(json, null, 0), 'utf8'); } // hack