{"id":21009626,"url":"https://github.com/yannick-cw/sjq","last_synced_at":"2025-05-15T02:33:12.962Z","repository":{"id":36779974,"uuid":"195259214","full_name":"yannick-cw/sjq","owner":"yannick-cw","description":"Command-line JSON processor with Scala syntax","archived":false,"fork":false,"pushed_at":"2024-07-11T02:48:51.000Z","size":36,"stargazers_count":53,"open_issues_count":40,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T03:02:21.328Z","etag":null,"topics":["cli","command-line","jq","json","scala"],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yannick-cw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-04T14:44:49.000Z","updated_at":"2024-08-04T11:18:56.000Z","dependencies_parsed_at":"2023-01-17T04:44:09.555Z","dependency_job_id":null,"html_url":"https://github.com/yannick-cw/sjq","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannick-cw%2Fsjq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannick-cw%2Fsjq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannick-cw%2Fsjq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannick-cw%2Fsjq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yannick-cw","download_url":"https://codeload.github.com/yannick-cw/sjq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254262577,"owners_count":22041445,"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":["cli","command-line","jq","json","scala"],"created_at":"2024-11-19T09:17:27.858Z","updated_at":"2025-05-15T02:33:12.704Z","avatar_url":"https://github.com/yannick-cw.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sjq\n\n## About\n\nUse Scala syntax to modify json fast and however you want from the Commandline.\n\nJust pass `code` to modify the `root` case class. sjq parses the json to a case class and allows editing and modifying it in any way.\n\ne.g.\n\n```bash\nsjq -a 'root.subclass.copy(name = root.subclass.name + \"Jo\")' -j '{ \"subclass\": { \"name\": \"Ho\", \"ids\": [22, 23, 24]  }}'\n{\n  \"name\" : \"HoJo\",\n  \"ids\" : [\n    22.0,\n    23.0,\n    24.0\n  ]\n}\n```\n\nOne example with a more complex json and a remote api:\n\n##### Get all hotel names with a score over 300\n\n```\ncurl https://www.holidaycheck.de/svc/search-api/search/mall\\?tenant\\=test \\\n| sjq -a 'root.destinations.entities.filter(_.rankingScore \u003e 300).map(_.name)'\n```\n\nreturns\n\n```\n[\n  \"Mallorca\",\n  \"Malles Venosta / Mals\",\n  \"Palma de Mallorca\"\n]\n```\n\n## Install \n\n`brew install yannick-cw/homebrew-tap/sjq`\n\nOr download the executable from the releases.\n\n## Usage\n\nYou can pass any valid scala code to access the json, the json is internally represented as a case class.\n\nThe input to use is the case class `root`\n\n```bash\nsjq -a 'root.subclass.ids.filter(id =\u003e id \u003e 22)' -j '{ \"subclass\": { \"name\": \"Ho\", \"ids\": [22, 23, 24]  }}'\n## Results in \n[\n  23.0,\n  24.0\n]\n```\n\n### Alternatively pipe input\n\n```bash\necho '{ \"subclass\": { \"name\": \"Ho\", \"ids\": [22, 23, 24]  }}' | sjq -a 'root.subclass.ids.filter(id =\u003e id \u003e 22)'\n```\n\n## Planned features\n\n* support subclasses with the same name with different value types\n* interactive mode with auto complete on json\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyannick-cw%2Fsjq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyannick-cw%2Fsjq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyannick-cw%2Fsjq/lists"}