Replies: 3 comments
-
Hi @stoutgz |
Beta Was this translation helpful? Give feedback.
0 replies
-
I have faced the same issue on it, then take the help of Chat GPT to convert the JSON to POSTMEN v2 JSON, and able to import all data successfully. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I utilized this Python script to address the issue; it works quite well and might be helpful. import json
def convert_to_postman(json_data):
postman_collection = {
"info": {
"_postman_id": json_data.get('name'),
"name": json_data.get('name'),
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": []
}
for folder in json_data.get('folders', []):
postman_folder = {
"name": folder.get('name'),
"item": []
}
for request in folder.get('requests', []):
postman_request = {
"name": request.get('name'),
"request": {
"method": request.get('method'),
"header": [],
"body": {
"mode": "raw",
"raw": json.dumps(request.get('body', {}).get('body'))
},
"url": {
"raw": request.get('endpoint'),
"host": [request.get('endpoint')]
}
}
}
postman_folder['item'].append(postman_request)
postman_collection['item'].append(postman_folder)
return postman_collection
with open('file.json') as f:
data = json.load(f)
postman_collection = convert_to_postman(data)
with open('postman_collection.json', 'w') as f:
json.dump(postman_collection, f, indent=4) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone! I'm exploring migrating to Hoppscotch from Postman, and with the Postman collection imports, it looks like it will be a breeze! But I'm curious if I were to change my mind down the road (hopefully not!), what would it look like to migrate back to Postman? I exported a collection from Hoppscotch and tried importing to Postman unsuccessfully. I'm wondering if there's some beta feature I don't have access to or a feature that was removed to choose the type you want to export to because the documentation references the ability to choose a "type" which I am never offered in the export process.
Please let me know if you know of a working process to export a collection from Hoppscotch and import it into Postman. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions