{"id":21740144,"url":"https://github.com/bserdar/gojsonpath","last_synced_at":"2026-04-17T06:31:26.160Z","repository":{"id":230770879,"uuid":"778650387","full_name":"bserdar/gojsonpath","owner":"bserdar","description":"Go JSON Path implementation with a flexible document model","archived":false,"fork":false,"pushed_at":"2025-10-01T02:39:39.000Z","size":204,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-27T00:35:13.536Z","etag":null,"topics":["go","json","jsonpath"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bserdar.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-03-28T05:59:58.000Z","updated_at":"2025-10-01T02:37:40.000Z","dependencies_parsed_at":"2024-04-19T02:33:11.301Z","dependency_job_id":null,"html_url":"https://github.com/bserdar/gojsonpath","commit_stats":null,"previous_names":["bserdar/gojsonpath"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/bserdar/gojsonpath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bserdar%2Fgojsonpath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bserdar%2Fgojsonpath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bserdar%2Fgojsonpath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bserdar%2Fgojsonpath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bserdar","download_url":"https://codeload.github.com/bserdar/gojsonpath/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bserdar%2Fgojsonpath/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31918479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"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":["go","json","jsonpath"],"created_at":"2024-11-26T06:12:23.508Z","updated_at":"2026-04-17T06:31:26.126Z","avatar_url":"https://github.com/bserdar.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GoDoc](https://godoc.org/github.com/bserdar/gojsonpath?status.svg)](https://godoc.org/github.com/bserdar/gojsonpath)\n[![Go Report Card](https://goreportcard.com/badge/github.com/bserdar/gojsonpath)](https://goreportcard.com/report/github.com/bserdar/gojsonpath)\n[![Build Status](https://github.com/bserdar/gojsonpath/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/bserdar/gojsonpath/actions/workflows/CI.yml)\n\n# JSONPath\n\nThis is a Go implementation of JSONPath introduced in:\n\nhttps://goessner.net/articles/JsonPath/\n\nas well as JSON path expressions of the form:\n\n```\n/key1/index/*/key2\n```\n\nwith the following exceptions:\n\n  * If a path component is a it should be a valid identifier or\n     number. If that is not the case, it should be a string literal,\n     that is, quoted.\n\n     For example: `$.dash-key` is invalid. You must quote it:\n     `$.\"dash-key\"` or `$.'dash-key'`.\n\n   * Function and method calls must have a possibly empty argument\n     list.\n\n     For example: `length(@)` and `@.length()` are valid, but\n     `@.length` will look for a `length` key under the current node.\n\n   * Decimals cannot start with a period, that is `.5` is\n     invalid. Use `0.5` instead. Decimal starting with a period\n     confuses the lexer.\n     \n   * Regular expressions are not supported yet.\n\n## Using JSONPath\n\nFirst, compile the path:\n\n``` \npath, err:= gojsonpath.Parse(\"$.store.book[*].author\")\n```\n\nThen you can use:\n\n```\nresults, err:= gojsonpath.Find(doc,path)\n```\n\nor you can capture the full-path for the nodes that match:\n\n``` go\nresult:=make([]any,0)\nerr := gojsonpath.Search(doc,path,func(elem []gojsonpath.Element) {\n  result=append(result,elem[len(elem)-1].Node)\n})\n```\n\nYou can use the simple path parser to compile '/' separated paths:\n\n```\npath, err := gojsonpath.Parse(\"/store/book/*/author\")\n```\n\nSimple paths must start with '/', and may contain object keys, array\nindexes, or '*' to match anything, separated by '/'.\n\n## Document model\n\nThis implementation of JSONPath works with a flexible document\nmodel. To use the familiar `map[string]any` implementation of JSON,\nuse:\n\n``` go\nvar jsonDoc any\njson.Unmarshal(jsonBytes,\u0026jsonDoc)\ndoc := gojsonpath.MapModel{Doc:jsonDoc}\n```\n\nThe `DocModel` interface provides a view of the underlying model, so\nthe JSON document does not have to be a `map[string]any`. Any\nhierarchical document model supporting key-value, array, and value\nnodes can be used.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbserdar%2Fgojsonpath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbserdar%2Fgojsonpath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbserdar%2Fgojsonpath/lists"}