{"id":21697877,"url":"https://github.com/yakubique/json-utils","last_synced_at":"2026-04-19T19:03:23.798Z","repository":{"id":220458417,"uuid":"751683682","full_name":"yakubique/json-utils","owner":"yakubique","description":"A collection of handy utilities for working with JSON in GitHub Actions, making it easier to manipulate JSON data","archived":false,"fork":false,"pushed_at":"2024-08-24T08:16:49.000Z","size":239,"stargazers_count":0,"open_issues_count":3,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-20T15:17:46.773Z","etag":null,"topics":["github-actions","json","lodash","processing"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/yakubique.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"ko_fi":"opa_oz"}},"created_at":"2024-02-02T05:11:01.000Z","updated_at":"2024-08-24T08:14:11.000Z","dependencies_parsed_at":"2024-02-02T06:44:05.862Z","dependency_job_id":"64ae78f1-ffa6-433b-8ccc-1e865c4711d9","html_url":"https://github.com/yakubique/json-utils","commit_stats":null,"previous_names":["yakubique/json-utils"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/yakubique/json-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakubique%2Fjson-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakubique%2Fjson-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakubique%2Fjson-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakubique%2Fjson-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yakubique","download_url":"https://codeload.github.com/yakubique/json-utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakubique%2Fjson-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32018765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["github-actions","json","lodash","processing"],"created_at":"2024-11-25T19:29:53.386Z","updated_at":"2026-04-19T19:03:23.776Z","avatar_url":"https://github.com/yakubique.png","language":"TypeScript","funding_links":["https://ko-fi.com/opa_oz","https://ko-fi.com/S6S1UZ9P7"],"categories":[],"sub_categories":[],"readme":"# json-utils\n\nA collection of handy utilities for working with JSON in GitHub Actions, making it easier to manipulate JSON data\n\nFor live examples, please see [actions](https://github.com/yakubique/json-utils/actions/workflows/test-myself.yaml)\n\n**Methods**:\n\n- [Diff](#diff)\n- [Sort](#sort)\n- [Pick](#pick)\n- [Get](#get)\n- [Concat](#concat)\n- [Chunk](#chunk)\n- [None](#none)\n\n## Diff\n\n### Flat\n\nOrder and values are taken from `input`. In this case it's `[\"1.3.0\"]`\n\n```yaml\nuses: yakubique/json-utils@v1.8\nwith:\n  input: '[\"1.0.0\",\"1.1.0\",\"1.2.0\",\"1.2.1\",\"1.3.0\"]'\n  secondary: '[\"1.0.0\",\"1.1.0\",\"1.2.0\",\"1.2.1\"]'\n  action: \"diff\"\n\n# result: \"[\"1.3.0\"]\"\n```\n\nIt'll return nothing if change direction\n\n```yaml\nuses: yakubique/json-utils@v1.8\nwith:\n  input: '[\"1.0.0\",\"1.1.0\",\"1.2.0\",\"1.2.1\"]'\n  secondary: '[\"1.0.0\",\"1.1.0\",\"1.2.0\",\"1.2.1\",\"1.3.0\"]'\n  action: \"diff\"\n\n# result: \"[]\"\n```\n\n### With nested json\n\nFind diff using `name` field in object\n\n```yaml\nuses: yakubique/json-utils@v1.8\nwith:\n  input: '[{\"name\":\"v0.3.26\",\"tag_name\":\"v0.3.26\",\"prerelease\":false,\"published_at\":\"2023-08-07T09:43:28Z\"},{\"name\":\"v0.3.22\",\"tag_name\":\"v0.3.22\",\"prerelease\":false,\"published_at\":\"2023-11-12T10:58:00Z\"},{\"name\":\"v0.3.23\",\"tag_name\":\"v0.3.23\",\"prerelease\":false,\"published_at\":\"2023-11-12T10:59:27Z\"},{\"name\":\"v0.3.25\",\"tag_name\":\"v0.3.25\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:01:20Z\"},{\"name\":\"v0.3.31\",\"tag_name\":\"v0.3.31\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:17:17Z\"},{\"name\":\"v0.3.34\",\"tag_name\":\"v0.3.34\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:21:59Z\"}]'\n  secondary: '[{\"name\":\"v0.3.26\",\"tag_name\":\"v0.3.26\",\"prerelease\":false,\"published_at\":\"2023-08-07T09:43:28Z\"},{\"name\":\"v0.3.22\",\"tag_name\":\"v0.3.22\",\"prerelease\":false,\"published_at\":\"2023-11-12T10:58:00Z\"},{\"name\":\"v0.3.23\",\"tag_name\":\"v0.3.23\",\"prerelease\":false,\"published_at\":\"2023-11-12T10:59:27Z\"},{\"name\":\"v0.3.25\",\"tag_name\":\"v0.3.25\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:01:20Z\"},{\"name\":\"v0.3.31\",\"tag_name\":\"v0.3.31\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:17:17Z\"}]'\n  action: \"diff\"\n  type: \"nested-json\"\n  key: \"name\"\n\n# result: \"[{\"name\":\"v0.3.34\",\"tag_name\":\"v0.3.34\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:21:59Z\"}]\"\n```\n\n### Use output\n\n```yaml\nsteps:\n  - name: Checkout\n    uses: actions/checkout@v4\n  - name: Diff two arrays\n    id: diff_two_arrays\n    uses: yakubique/json-utils@v1.8\n    with:\n      input: '[\"1.0.0\",\"1.1.0\",\"1.2.0\",\"1.2.1\",\"1.3.0\"]'\n      secondary: '[\"1.0.0\",\"1.1.0\",\"1.2.0\",\"1.2.1\"]'\n      action: \"diff\"\n  - name: Test 1\n    run: |\n      echo \"Expecting ['1.3.0']\"\n      echo \"${{ steps.diff_two_arrays.outputs.result }}\"\n      test \"${{ steps.diff_two_arrays.outputs.result }}\" == \"[1.3.0]\"\n```\n\n## Sort\n\n### Flat\n\nBy default it's `Ascending`\n\n```yaml\nuses: yakubique/json-utils@v1.8\nwith:\n  input: '[\"1.0.0\",\"1.1.0\",\"1.2.0\",\"1.2.1\",\"1.3.0\"]'\n  action: \"sort\"\n```\n\n`Descending`\n\n```yaml\nuses: yakubique/json-utils@v1.8\nwith:\n  input: '[\"1.0.0\",\"1.1.0\",\"1.2.0\",\"1.2.1\",\"1.3.0\"]'\n  action: \"sort\"\n  modifier: \"desc\"\n```\n\n### With nested json\n\nFind diff using `name` field in object\n\n```yaml\nuses: yakubique/json-utils@v1.8\nwith:\n  input: '[{\"name\":\"v0.3.26\",\"tag_name\":\"v0.3.26\",\"prerelease\":false,\"published_at\":\"2023-08-07T09:43:28Z\"},{\"name\":\"v0.3.22\",\"tag_name\":\"v0.3.22\",\"prerelease\":false,\"published_at\":\"2023-11-12T10:58:00Z\"},{\"name\":\"v0.3.23\",\"tag_name\":\"v0.3.23\",\"prerelease\":false,\"published_at\":\"2023-11-12T10:59:27Z\"},{\"name\":\"v0.3.25\",\"tag_name\":\"v0.3.25\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:01:20Z\"},{\"name\":\"v0.3.31\",\"tag_name\":\"v0.3.31\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:17:17Z\"},{\"name\":\"v0.3.34\",\"tag_name\":\"v0.3.34\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:21:59Z\"}]'\n  action: \"sort\"\n  type: \"nested-json\"\n  key: \"name\"\n  modifier: \"desc\"\n```\n\n### Use output\n\n```yaml\nsteps:\n  - name: Checkout\n    uses: actions/checkout@v4\n  - name: Sort array of strings\n    id: sort_array\n    uses: yakubique/json-utils@v1.8\n    with:\n      input: '[\"1.0.0\",\"1.1.0\",\"1.2.0\",\"1.2.1\",\"1.3.0\"]'\n      action: \"sort\"\n      modifier: \"desc\"\n  - name: Test 1\n    run: |\n      echo \"Expecting [1.3.0,1.2.1,1.2.0,1.1.0,1.0.0]\"\n      echo \"${{ steps.sort_array.outputs.result }}\"\n```\n\n## Pick\n\nCreates an object composed of the picked object properties.\n\n```yaml\n- name: Pick \"name\"\n  uses: yakubique/json-utils@v1.8\n  with:\n    input: '[{\"name\":\"v0.3.26\",\"tag_name\":\"v0.3.26\",\"prerelease\":false,\"published_at\":\"2023-08-07T09:43:28Z\"},{\"name\":\"v0.3.22\",\"tag_name\":\"v0.3.22\",\"prerelease\":false,\"published_at\":\"2023-11-12T10:58:00Z\"},{\"name\":\"v0.3.23\",\"tag_name\":\"v0.3.23\",\"prerelease\":false,\"published_at\":\"2023-11-12T10:59:27Z\"},{\"name\":\"v0.3.25\",\"tag_name\":\"v0.3.25\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:01:20Z\"},{\"name\":\"v0.3.31\",\"tag_name\":\"v0.3.31\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:17:17Z\"},{\"name\":\"v0.3.34\",\"tag_name\":\"v0.3.34\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:21:59Z\"}]'\n    action: \"pick\"\n    key: \"name\"\n```\n\nWorks with multiple comma-separated keys\n\n```yaml\n- name: Pick \"name\"\n  uses: yakubique/json-utils@v1.8\n  with:\n    input: '[{\"name\":\"v0.3.26\",\"tag_name\":\"v0.3.26\",\"prerelease\":false,\"published_at\":\"2023-08-07T09:43:28Z\"},{\"name\":\"v0.3.22\",\"tag_name\":\"v0.3.22\",\"prerelease\":false,\"published_at\":\"2023-11-12T10:58:00Z\"},{\"name\":\"v0.3.23\",\"tag_name\":\"v0.3.23\",\"prerelease\":false,\"published_at\":\"2023-11-12T10:59:27Z\"},{\"name\":\"v0.3.25\",\"tag_name\":\"v0.3.25\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:01:20Z\"},{\"name\":\"v0.3.31\",\"tag_name\":\"v0.3.31\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:17:17Z\"},{\"name\":\"v0.3.34\",\"tag_name\":\"v0.3.34\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:21:59Z\"}]'\n    action: \"pick\"\n    key: \"name,prerelease\"\n\n  # returns: [{name:v0.3.26,prerelease:false},{name:v0.3.22,prerelease:false},{name:v0.3.23,prerelease:false},{name:v0.3.25,prerelease:false},{name:v0.3.31,prerelease:false},{name:v0.3.34,prerelease:false}]\n```\n\n## Get\n\nReturn only value of picket object property.\n\n```yaml\n  - name: Get \"name\"\n    id: get_name\n    uses: yakubique/json-utils@v1.8\n    with:\n      input: '[{\"name\":\"v0.3.26\",\"tag_name\":\"v0.3.26\",\"prerelease\":false,\"published_at\":\"2023-08-07T09:43:28Z\"},{\"name\":\"v0.3.22\",\"tag_name\":\"v0.3.22\",\"prerelease\":false,\"published_at\":\"2023-11-12T10:58:00Z\"},{\"name\":\"v0.3.23\",\"tag_name\":\"v0.3.23\",\"prerelease\":false,\"published_at\":\"2023-11-12T10:59:27Z\"},{\"name\":\"v0.3.25\",\"tag_name\":\"v0.3.25\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:01:20Z\"},{\"name\":\"v0.3.31\",\"tag_name\":\"v0.3.31\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:17:17Z\"},{\"name\":\"v0.3.34\",\"tag_name\":\"v0.3.34\",\"prerelease\":false,\"published_at\":\"2023-11-12T11:21:59Z\"}]'\n      action: \"get\"\n      key: \"name\"\n\n  # returns: [v0.3.26,v0.3.22,v0.3.23,v0.3.25,v0.3.31,v0.3.34]\n```\n\n## Concat\n\nConcat `input` and `secondary` JSON arrays\n\n```yaml\n  - name: Concat two arrays\n    uses: yakubique/json-utils@v1.8\n    with:\n      input: '[\"1.0.0\",\"1.1.0\",]'\n      secondary: '[\"1.2.0\",\"1.2.1\",\"1.3.0\"]'\n      action: \"concat\"\n\n  # returns: [\"1.0.0\",\"1.1.0\",\"1.2.0\",\"1.2.1\",\"1.3.0\"]\n```\n\n## Chunk\n\nCreates an array of elements split into groups the length of `modifier`. If array can't be split evenly, the final chunk\nwill be the remaining elements.\n\n```yaml\n  - name: Chunk array\n    uses: yakubique/json-utils@v1.8\n    with:\n      input: '[1,2,3,4,5]'\n      action: \"chunk\"\n      modifier: 3\n\n  # returns: [[1,2,3],[4,5]]\n```\n\n## None\n\nSometimes it's OK to do nothing\n\n```yaml\n  - name: Nothing to do\n    uses: yakubique/json-utils@v1.8\n    with:\n      input: '[1,2,3,4,5]'\n      action: \"none\"\n\n  # returns: [1,2,3,4,5]\n```\n\n## Inputs\n\n\u003c!-- AUTO-DOC-INPUT:START - Do not remove or modify this section --\u003e\n\n|   INPUT   |  TYPE  | REQUIRED |    DEFAULT    |                                              DESCRIPTION                                              |\n|-----------|--------|----------|---------------|-------------------------------------------------------------------------------------------------------|\n|  action   | string |   true   |               | What to do with input JSON \u003cbr\u003e(available: \"diff\", \"get\", \"pick\", \"sort\", \"concat\", \"chunk\", \"none\")  |\n|   input   | string |   true   |               |                                  JSON string/Value from other action                                  |\n|    key    | string |  false   |               |                        If `type=\"nested-json\"` - which key should \u003cbr\u003ebe used                         |\n| modifier  | string |  false   |               |                 Suitable modifier for performed action (ex: 'ASC'/'DESC' for 'sort')                  |\n| secondary | string |  false   |               |             Secondary JSON string/Value from other action \u003cbr\u003e(useful for some actions)               |\n|   space   | string |  false   |               |                         `space` parameter to JSON.stringify as a \u003cbr\u003enumber                           |\n| from_file | string |  false   |   `\"false\"`   |                           Load input from file (applied to secondary too)                             |\n|  to_file  | string |  false   |   `\"false\"`   |                                            Output to file                                             |\n|   type    | string |  false   | `\"flat-json\"` |               Type of input data `[\"flat-json\", \"nested-json\"]` (default: \"flat-json\")                |\n\n\u003c!-- AUTO-DOC-INPUT:END --\u003e\n\n## Outputs\n\n\u003c!-- AUTO-DOC-OUTPUT:START - Do not remove or modify this section --\u003e\n\n| OUTPUT |  TYPE  |  DESCRIPTION   |\n|--------|--------|----------------|\n| result | string | Processed JSON |\n\n\u003c!-- AUTO-DOC-OUTPUT:END --\u003e\n\n\n----\n\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/S6S1UZ9P7)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyakubique%2Fjson-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyakubique%2Fjson-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyakubique%2Fjson-utils/lists"}