{"id":24498498,"url":"https://github.com/izziiyt/jsdp","last_synced_at":"2025-07-12T08:37:49.921Z","repository":{"id":255438554,"uuid":"850190742","full_name":"izziiyt/jsdp","owner":"izziiyt","description":"simple command line tool to sort json in deep (including arrays)","archived":false,"fork":false,"pushed_at":"2024-08-31T07:45:02.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T22:11:37.916Z","etag":null,"topics":["json","normalize","sort"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/izziiyt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-31T05:17:51.000Z","updated_at":"2024-08-31T08:28:33.000Z","dependencies_parsed_at":"2024-09-02T04:56:38.706Z","dependency_job_id":"a85b5ffc-934a-4ef7-bfd8-4093de176cd0","html_url":"https://github.com/izziiyt/jsdp","commit_stats":null,"previous_names":["izziiyt/jsia","izziiyt/dstj"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izziiyt%2Fjsdp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izziiyt%2Fjsdp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izziiyt%2Fjsdp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izziiyt%2Fjsdp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/izziiyt","download_url":"https://codeload.github.com/izziiyt/jsdp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243695598,"owners_count":20332629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","normalize","sort"],"created_at":"2025-01-21T22:11:36.377Z","updated_at":"2025-03-15T07:13:24.546Z","avatar_url":"https://github.com/izziiyt.png","language":"Go","readme":"[![CI][ci-img]][ci]\n[![Go Report Card][go-report-img]][go-report]\n[![License: MIT][license-img]][license]\n\n# Why jsdp (Json Sort in Deep)?\n\n`jsdp` is a simple tool for recursively sorting objects and arrays in JSON files.\nIt is useful in situations where you want to compare JSON files that have the same content but different order.\nWhile `jq -S` and `dictknife` can sort objects, they cannot sort arrays.\nIn such cases, `jsdp` is superior as it can also sort the contents of arrays.\n\n# Install\n\ngo\n```bash\ngo install github.com/izziiyt/jsdp\n```\n\nmise\n```bash\nmise use --global go:github.com/izziiyt/jsdp\n```\n\n# Example\n\n(`jq` is required)\n\n```bash\n$ cat 0.json\n{\n  \"b\": 2,\n  \"a\": [\n    false,\n    { \n      \"a\": 1 \n    },\n    1,\n    null,\n    2.1,\n    \"value\",\n    [3, 2, 1]\n  ]\n}\n$ cat 1.json\n{\n  \"a\": [\n    2.1,\n    1,\n    { \n      \"a\": 1 \n    },\n    null,\n    [2, 3, 1],\n    \"value\"\n  ],\n  \"b\": 2\n}\n$ diff \u003c(jsdp 0.json | jq) \u003c(cat 1.json | jsdp | jq)\n3d2\n\u003c     false,\n```\n\n# Sorting Order\n\nEverything is sorted in ascending order.\nThe data types in the JSON are described according to [RFC-8259](https://datatracker.ietf.org/doc/html/rfc8259#section-3).\n\n## object\n\nObjects are sorted by the string order of their keys.\n\nbefore\n```json\n{\n  \"c\": false,\n  \"a\": 1,\n  \"b\": null\n}\n```\n\nafter\n```json\n{\n  \"a\": 1,\n  \"b\": null,\n  \"c\": false\n}\n```\n\n## array\n\nArrays are sorted first by the following order of data types:\n\n- false\n- true\n- number\n- string\n- array\n- object\n- null\n\nSubarrays divided by type are then sorted according to their respective types.\n\nbefore\n```json\n{\n  \"a\": [\n    { \"a\":  1},\n    false,\n    \"b\",\n    1,\n    null,\n    \"a\",\n    [1, false],\n    true,\n    0.5\n  ]\n}\n```\n\nafter\n```json\n{\n  \"a\": [\n    false,\n    true,\n    0.5,\n    1,\n    \"a\",\n    \"b\",\n    [false, 1],\n    { \"a\":  1},\n    null\n  ]\n}\n```\n\n[ci]: https://github.com/izziiyt/jsdp/actions/workflows/ci.yaml\n[ci-img]: https://github.com/izziiyt/jsdp/actions/workflows/ci.yml/badge.svg\n[go-report]: https://goreportcard.com/report/github.com/izziiyt/jsdp\n[go-report-img]: https://goreportcard.com/badge/github.com/izziiyt/jsdp\n[license]: https://opensource.org/licenses/MIT\n[license-img]: https://img.shields.io/badge/License-MIT-yellow.svg\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizziiyt%2Fjsdp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fizziiyt%2Fjsdp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizziiyt%2Fjsdp/lists"}