# postman-collection-transformer

> Perform rapid conversation and validation of JSON structure between Postman Collection Format v1 and v2

Latest version **4.1.14** (published 2026-07-29) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install postman-collection-transformer
pnpm add postman-collection-transformer
yarn add postman-collection-transformer
bun add postman-collection-transformer
```

Provides the command `postman-collection-transformer`.

## Health

**Score 50/100 (C)** — status: active.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 4.1.14 |
| Published | 2026-07-29 |
| First published | 2015-07-08 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 5 |
| Unpacked size | 188.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 90 |
| Author | Postman Inc. |
| Maintainers | shamasis, codenirvana, saswatds, appurvamurawat, kdevakumaran |
| Keywords | postman, collection, json, format, converter, transformer |

## Links

- npm: https://www.npmjs.com/package/postman-collection-transformer
- Repository: https://github.com/postmanlabs/postman-collection-transformer
- Homepage: https://github.com/postmanlabs/postman-collection-transformer#readme
- Issues: https://github.com/postmanlabs/postman-collection-transformer/issues
- npm.io page: https://npm.io/package/postman-collection-transformer

## Dependencies (5)

- [lodash](https://npm.io/package/lodash.md) 4.18.1
- [semver](https://npm.io/package/semver.md) 7.5.4
- [inherits](https://npm.io/package/inherits.md) 2.0.4
- [commander](https://npm.io/package/commander.md) 8.3.0
- [strip-json-comments](https://npm.io/package/strip-json-comments.md) 3.1.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 4.1.14 (latest) — 2026-07-29
- 3.3.1-beta.1 (beta) — 2020-03-26
- 2.8.0-hotfix.1 (hotfix) — 2018-09-20
- 2.0.4-webhooktest.8 (temp) — 2016-11-16
- 0.1.1-hotfix.3 (documenter) — 2016-05-02
- 4.1.13 — 2026-02-24
- 4.1.12 — 2025-08-19
- 4.1.11 — 2025-05-30
- 4.1.10 — 2025-02-27
- 4.1.9 — 2025-02-11
- 4.1.8 — 2023-10-12
- 4.1.7 — 2023-09-13
- 4.1.6 — 2022-02-23
- 4.1.5 — 2022-02-21
- 4.1.4 — 2021-10-22
- … 139 more at https://npm.io/package/postman-collection-transformer/versions

## README

# Postman Collection Transformer [![Build Status](https://github.com/postmanlabs/postman-collection-transformer/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/postmanlabs/postman-collection-transformer/actions/workflows/ci.yml)

Perform rapid conversion of JSON structure between Postman Collection Format v1 and v2.

The formats are documented at https://schema.postman.com

## Installation

For CLI usage:

    $ npm install -g postman-collection-transformer

As a library:

    $ npm install --save postman-collection-transformer

## Usage

#### Converting Entire Collections

The transformer provides a Command line API to convert collections.

Example:

    $ postman-collection-transformer convert \
        --input ./v1-collection.json \
        --input-version 2.0.0 \
        --output ./v2-collection.json \
        --output-version 1.0.0 \
        --pretty \
        --overwrite

All options:

    $ postman-collection-transformer convert -h

      Usage: convert [options]

      Convert Postman Collection from one format to another

      Options:

        -h, --help                      output usage information
        -i, --input <path>              path to the input postman collection file
        -j, --input-version [version]   the version of the input collection format standard (v1 or v2)
        -o, --output <path>             target file path where the converted collection will be written
        -p, --output-version [version]  required version to which the collection is needed to be converted to
        -P, --pretty                    Pretty print the output
        --retain-ids                    Retain the request and folder IDs during conversion (collection ID is always retained)
        -w, --overwrite                 Overwrite the output file if it exists

If you'd rather use the transformer as a library:
```javascript
    var transformer = require('postman-collection-transformer'),
        collection = require('./path/to/collection.json'),
        inspect = require('util').inspect,

        options = {
            inputVersion: '1.0.0',
            outputVersion: '2.0.0',
            retainIds: true  // the transformer strips request-ids etc by default.
        };

    transformer.convert(collection, options, function (error, result) {
        if (error) {
            return console.error(error);
        }

        // result <== the converted collection as a raw Javascript object
        console.log(inspect(result, {colors: true, depth: 10000}));
    });
```

#### Converting Individual Requests

The transformer also allows you to convert individual requests (only supported when used as a library):

###### Example
```javascript

    var transformer = require('postman-collection-transformer'),

        objectToConvert = { /* A valid collection v1 Request or a collection v2 Item */ },

        options = {
            inputVersion: '1.0.0',
            outputVersion: '2.0.0',
            retainIds: true  // the transformer strips request-ids etc by default.
        };

    transformer.convertSingle(objectToConvert, options, function (err, converted) {
        console.log(converted);
    });
```

#### Converting Individual Responses

You can convert individual responses too if needed:

###### Example
```javascript

    var transformer = require('postman-collection-transformer'),

        objectToConvert = { /* A v1 Response or a v2 Response */ },

        options = {
            inputVersion: '1.0.0',
            outputVersion: '2.0.0',
            retainIds: true  // the transformer strips request-ids etc by default.
        };

    transformer.convertResponse(objectToConvert, options, function (err, converted) {
        console.log(converted);
    });
```

#### Normalizing v1 collections

The transformer also provides a Command line API to normalize collections for full forward compatibility.

Example:

    $ postman-collection-transformer normalize \
        --input ./v1-collection.json \
        --normalize-version 1.0.0 \
        --output ./v1-norm-collection.json \
        --pretty \
        --overwrite

All options:

    $ postman-collection-transformer normalize -h

      Usage: normalize [options]

      Normalizes a postman collection according to the provided version


      Options:

        -i, --input <path>                 Path to the collection JSON file to be normalized
        -n, --normalize-version <version>  The version to normalizers the provided collection on
        -o, --output <path>                Path to the target file, where the normalized collection will be written
        -P, --pretty                       Pretty print the output
        --retain-ids                       Retain the request and folder IDs during conversion (collection ID is always retained)
        -w, --overwrite                    Overwrite the output file if it exists
        -h, --help                         Output usage information


If you'd rather use the transformer as a library:
```javascript
    var transformer = require('postman-collection-transformer'),
        collection = require('./path/to/collection.json'),
        inspect = require('util').inspect,

        options = {
            normalizeVersion: '1.0.0',
            mutate: false, // performs in-place normalization, false by default.
            noDefaults: false, // when set to true, sensible defaults for missing properties are skipped. Default: false
            prioritizeV2: false, // when set to true, v2 attributes are used as the source of truth for normalization.
            retainEmptyValues: false, // when set to true, empty values are set to '', not removed. False by default.
            retainIds: true  // the transformer strips request-ids etc by default.
        };

    transformer.normalize(collection, options, function (error, result) {
        if (error) {
            return console.error(error);
        }

        // result <== the converted collection as a raw Javascript object
        console.log(inspect(result, {colors: true, depth: 10000}));
    });
```

---
_Source: https://npm.io/package/postman-collection-transformer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
