{"id":17684717,"url":"https://github.com/batteredbunny/rjson","last_synced_at":"2026-05-03T02:44:05.340Z","repository":{"id":180550772,"uuid":"665316891","full_name":"BatteredBunny/rjson","owner":"BatteredBunny","description":"a jq like library for golang that helps parse nested json","archived":false,"fork":false,"pushed_at":"2024-01-07T00:54:09.000Z","size":86,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-05T23:02:36.595Z","etag":null,"topics":["golang","json"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BatteredBunny.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}},"created_at":"2023-07-12T00:14:26.000Z","updated_at":"2023-07-18T09:40:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"915ce6ad-e88d-40e8-b009-aeefbaed530b","html_url":"https://github.com/BatteredBunny/rjson","commit_stats":null,"previous_names":["ayes-web/rjson","batteredbunny/rjson"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BatteredBunny%2Frjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BatteredBunny%2Frjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BatteredBunny%2Frjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BatteredBunny%2Frjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BatteredBunny","download_url":"https://codeload.github.com/BatteredBunny/rjson/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246373194,"owners_count":20766717,"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":["golang","json"],"created_at":"2024-10-24T10:24:51.567Z","updated_at":"2026-05-03T02:44:05.334Z","avatar_url":"https://github.com/BatteredBunny.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003erjson\u003c/h1\u003e\n\na jq like library for golang that helps parse nested json\n\n```\ngo get github.com/BatteredBunny/rjson\n```\n\n## Parse nested json without any anonymous structs\n```go\ntype Out struct {\n\tOne     string      `rjson:\"uwu.nya\"`           // \"123\"\n\tTwo     int         `rjson:\"one.two.three.num\"` // 1\n\tThree   []string    `rjson:\"one.arr\"`           // [\"a\",\"b\"]\n    Four    string      `rjson:\"one.arr[0]\"`        // \"a\"\n}\n```\n\n```json\n{\n    \"uwu\": {\n        \"nya\": \"123\"\n    },\n    \"one\": {\n        \"two\": {\n            \"three\": {\n                \"num\": 1\n            }\n        },\n        \"arr\": [\n            \"a\",\n            \"b\"\n        ]\n    }\n}\n```\n\nFor a more complete example have a look at `tag_test.go`\n\n## Try out the parsing in an interactive form\n\n![cli example](cli-example.png)\n\n```\ngo run github.com/BatteredBunny/rjson/cmd/livejson --file example.json\n```\n\n## Helpful\n\n### Debugging\nIf the json isnt parsing as expected try enabling the rjson.Debug variable.\n```rjson.Debug = true```\n\n### Jetbrains\nFor quickly parsing json, in jetbrains IDE you can directly copy the json pointer and paste it into rjson field tag\n![tip](jetbrains-copy.png)\n\ncopied value: ``onResponseReceivedActions[0].appendContinuationItemsAction.continuationItems[76].playlistVideoRenderer.thumbnail.thumbnails``\n\n\n## Syntax explanation\n\n### Path seperator: \".\"\n- Dot symbol is used as path seperator, e.g `one.two.three`\n\n### Array index: [0]\n- You can index slices/array like you would normally, e.g `arr[0]`, `arr[1]`\n\n### Last value: [-]\n- You can access the last value of an slices/array using this, e.g `arr[-]`\n\n### Value iterator: []\n\n- e.g `arr[].text`\n\n    #### Input\n    ```json\n\t{\n\t    \"arr\": [\n\t        {\n\t            \"text\": \"1\",\n\t            \"num\": 1\n\t        },\n\t        {\n\t            \"text\": \"2\",\n\t            \"num\": 2\n\t        },\n\t        {\n\t            \"no_commons\": \"this object has no common fields, so it wont be included\"\n\t        }\n\t    ]\n\t}\n    ```\n\n    #### Output\n    ```json\n    [\n        {\n            \"text\": \"1\",\n        },\n        {\n            \"text\": \"2\",\n        }\n    ]\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbatteredbunny%2Frjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbatteredbunny%2Frjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbatteredbunny%2Frjson/lists"}