Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

chore: prettify collection contents before export (#4687)

Dmitry0aa509e80469
diff --git a/packages/hoppscotch-common/src/components/collections/index.vue b/packages/hoppscotch-common/src/components/collections/index.vue
index 6c083b604..f0656c38b 100644
--- a/packages/hoppscotch-common/src/components/collections/index.vue
+++ b/packages/hoppscotch-common/src/components/collections/index.vue
@@ -2666,7 +2666,7 @@ const initializeDownloadCollection = async (
*/
const exportData = async (collection: HoppCollection | TeamCollection) => {
if (collectionsType.value.type === "my-collections") {
- const collectionJSON = JSON.stringify(collection)
+ const collectionJSON = JSON.stringify(collection, null, 2)
const name = (collection as HoppCollection).name
@@ -2685,7 +2685,7 @@ const exportData = async (collection: HoppCollection | TeamCollection) => {
},
async (coll) => {
const hoppColl = teamCollToHoppRESTColl(coll)
- const collectionJSONString = JSON.stringify(hoppColl)
+ const collectionJSONString = JSON.stringify(hoppColl, null, 2)
await initializeDownloadCollection(
collectionJSONString,
diff --git a/packages/hoppscotch-common/src/helpers/backend/helpers.ts b/packages/hoppscotch-common/src/helpers/backend/helpers.ts
index ca9f06a64..6f2478bf1 100644
--- a/packages/hoppscotch-common/src/helpers/backend/helpers.ts
+++ b/packages/hoppscotch-common/src/helpers/backend/helpers.ts
@@ -254,5 +254,5 @@ export const getTeamCollectionJSON = async (teamID: string) => {
}
const hoppCollections = collections.map(teamCollectionJSONToHoppRESTColl)
- return E.right(JSON.stringify(hoppCollections))
+ return E.right(JSON.stringify(hoppCollections, null, 2))
}