diff --git a/README.rst b/README.rst
index 8ffd9b7..04a53d0 100644
--- a/README.rst
+++ b/README.rst
@@ -45,6 +45,7 @@ optional arguments:
   -h, --help  show this help message and exit
   --version   show version and exit
   --import IMPORT  modules to import
+  --sort-keys, -S  sort keys in objects when the command print it
 
 
 Example
diff --git a/jqp/__init__.py b/jqp/__init__.py
index 90fd8de..1e20c00 100644
--- a/jqp/__init__.py
+++ b/jqp/__init__.py
@@ -14,7 +14,7 @@ def _exit(error, return_code, message):
     sys.exit(return_code)
 
 
-def run(in_io, out_io, cmd, imports=[]):
+def run(in_io, out_io, cmd, imports=[], sort_keys=False):
     environment = {}
     for mod_name in imports:
         try:
@@ -40,7 +40,7 @@ def run(in_io, out_io, cmd, imports=[]):
             _exit(e, 3, 'Cannot execute command: line %d' % line_no)
 
         try:
-            json.dump(out, out_io)
+            json.dump(out, out_io, sort_keys=sort_keys)
         except Exception as e:
             _exit(e, 3, 'Cannot dump result: line %d' % line_no)
 
@@ -56,7 +56,11 @@ def main():
     parser.add_argument(
         '--import', action='append',
         help='modules to import')
+    parser.add_argument(
+        '--sort-keys', '-S', action='store_true',
+        help='sort keys in objects when the command print it')
 
     args = parser.parse_args()
 
-    run(sys.stdin, sys.stdout, args.cmd, imports=getattr(args, 'import'))
+    run(sys.stdin, sys.stdout, args.cmd, imports=getattr(args, 'import'),
+        sort_keys=args.sort_keys)

Add option to sort keys
`--sort-keys` / `-S` to sort keys.
diff --git a/tests/run_test.py b/tests/run_test.py
index 8e64641..4f26ab8 100644
--- a/tests/run_test.py
+++ b/tests/run_test.py
@@ -23,6 +23,14 @@ class RunTest(unittest.TestCase):
         jqp.run(inputs, outputs, 're.sub("a", "A", j["name"])', imports=['re'])
         self.assertEqual(outputs.getvalue(), '"TAro"\n')
 
+    def test_sort_keys(self):
+        # This command ignores input
+        inputs = StringIO('''1
+''')
+        outputs = StringIO()
+        jqp.run(inputs, outputs, '{"a": 0, "b": 0, "c": 0}', sort_keys=True)
+        self.assertEqual(outputs.getvalue(), '{"a": 0, "b": 0, "c": 0}\n')
+
     def test_parse_error(self):
         inputs = StringIO('invalid\n')
         outputs = StringIO()

pip install -e .
parse_log_pytest
pytest
pytest pytest-cov
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
coverage==7.8.0
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
-e git+https://github.com/unnonouno/jqp.git@0b56b8127bf430cab872c71f62329094e666f995#egg=jqp
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
pytest @ file:///croot/pytest_1738938843180/work
pytest-cov==6.0.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work

name: jqp
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - exceptiongroup=1.2.0=py39h06a4308_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - packaging=24.2=py39h06a4308_0
  - pip=25.0=py39h06a4308_0
  - pluggy=1.5.0=py39h06a4308_0
  - pytest=8.3.4=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py39h06a4308_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - coverage==7.8.0
      - pytest-cov==6.0.0
prefix: /opt/conda/envs/jqp

tests/run_test.py::RunTest::test_sort_keys
tests/run_test.py::RunTest::test1 tests/run_test.py::RunTest::test_dump_error tests/run_test.py::RunTest::test_execution_error tests/run_test.py::RunTest::test_import tests/run_test.py::RunTest::test_import_error tests/run_test.py::RunTest::test_parse_error
README.rst jqp/__init__.py
README.rst jqp/__init__.py