/postman-sort

Sort Postman Collection data (including Folders/Requests/Variables/Params/Examples) or Environments (in v2.1 format)

Primary LanguagePython

Why

See the following discussions in the Postman project:

What to sort

  1. For Environments
    • Variables
  2. For Collections
    • Variables
    • Folders (can be nested)
    • Requests
    • Requests' Params
    • Requests' Examples (including example's Params)

How to use

  1. In Postman, export a Collection or Environment to a JSON file (e.g. unsorted.json) in v2.1 format.

  2. Run

    python3 pm-sort.py unsorted.json > sorted.json
    # or
    python3 pm-sort.py < unsorted.json > sorted.json
    
  3. In Postman, import sorted.json. (To be safe, choose Import as Copy when prompted.)