You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
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
I have a POST endpoint that takes an array of an arbitrary size:
The
vehicle_data
is fed by a CSV that contains JSON-like data:
This CSV is then fed & run in the Runner.
Since the last update, the
Error while parsing data file: Error: Invalid Closing Quote: got """ at line 2 instead of delimiter, row delimiter, trimable character (if activated) or comment
has caused this collection to not be runnable.
If one escapes the double quotes, it breaks the formatting of the CSV. The formatting of the CSV is important, as the document is maintained by a non-technical team.
The CSV can't be updated to reference specific values, as the array is of an arbitrary size.
One could try changing the file to be JSON instead of CSV, however 1) one would need to update all requests to properly handle the new format, and 2) editing JSON is a terrible user experience, if not untenable for non-technical members.
This functionality worked before - what is the best path forward?
@cjtoth
... we fixed a number of bugs underlying the CSV parsing in latest release. I am assuming that this code path worked previously because a bug in parsing. This is a hunch from first impressions.
@vikiCoder
can elaborate if that is the case.
Our alternatives are:
Use a small CLI code to pre-process before sending to Postman
Check if providing additional CSV parsing options would help
Can you post a non-sensitive scaled down sample of the CSV, just in case the rest of the team miss out the nuances of your file?
We have the same issue.
For us it is really convenient to use google sheet for storing test data then just download it as CSV for feeding the Postman tests.
Their use double quotes '"' for escaping quotes in the csv. Unfortunately this can not be parsed anymore after getting the updates by
7.2.219 Jun, 2019 - GitHub
#3178
There is no way to change the escape character for google sheet export.
It would be really good to get the ability of choosing the escape character in postman
I am trying to figure out how we could export directly into json format.
Here is a small python script that helps with converting the quote escaped csv files to the json ones that can be still parsed with Postman:
import csv
import json
from collections import OrderedDict
file_name = '<YourLocalFileNameHere>'
fieldnames = ()
entries = []
with open(file_name + '.csv', 'r') as f:
fieldnames = f.readline().replace("\n", "").split(',')
print("CSV field names are:", fieldnames)
with open(file_name + '.csv', 'r') as csv_file:
reader = csv.DictReader(csv_file, fieldnames)
for row_number, row in enumerate(reader):
if row_number != 0:
entry = OrderedDict()
for field in fieldnames:
if row[field].isdigit():
entry[field] = float(row[field])
else:
entry[field] = row[field]
entries.append(entry)
output = entries
with open(file_name.replace(" ", "_") + '.json', 'w') as json_file:
json.dump(output, json_file)
We have fixed this issue and it is out in the latest canary of Postman App (version 7.3.0-canary05).
@cjtoth Now you can use quotes inside unquoted fields without escaping them in CSV file. As a result, you can now use JSON-like data inside CSV file without escaping quotes as it was before the 7.2.2 release of Postman App.
@xmaska We have also changed escape character from \
to "
. So now you can use exported CSV file from Google Sheets directly without preprocessing it.
Check out the canary version of the Postman App and let us know if you are still facing any issues.