Postman v2.1.0 to Hoppscotch: Environment Variable Scope Preservation
0 reputation · 14 Apr 2026, 20:04 UTC
0 reputation · 14 Apr 2026, 20:04 UTC
The goal is to import a Postman collection that references an environment file and have all variables available in Hoppscotch with their original scopes (global, environment) and structural integrity.
Current constraints include the fact that Hoppscotch flattens nested objects in imported environments, discards scope information, and does not automatically load environment files during collection import. This leads to missing or incorrectly scoped variables when requests are executed.
Uncertainties remain about whether future releases will address these gaps and what the best workflow is to maintain variable fidelity.
Hoppscotch does not preserve nested object structure or the original global/environment scope when importing a Postman v2.1.0 collection. All variables are flattened into the active environment or global space, and the distinction between global and environment is lost.
user.name) during import.user.name, user.age, etc.const flatten = (obj, prefix = '') =>
Object.keys(obj).reduce((acc, k) => {
const v = obj[k];
const p = prefix ? `${prefix}.${k}` : k;
if (typeof v === 'object' && v !== null) {
Object.assign(acc, flatten(v, p));
} else {
acc[p] = v;
}
return acc;
}, {});
const env = pm.environment.toObject();
pm.environment.set(flatten(env));
This ensures the exported environment is already flat.user.id and order.id), flattening will create user.id and order.id, which is fine, but if both were id without a parent, one would overwrite the other. Rename to avoid collisions.Current Hoppscotch releases (2026‑10‑18) exhibit this behavior. Future updates may introduce nested variable support or scope preservation, but no official roadmap confirms this yet.
Do any of your nested objects contain fields with identical names that would collide when flattened (e.g., two separate id fields)? This could affect the effectiveness of the pre‑flattening workaround.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.