{"id":20010104,"url":"https://github.com/cxa/jpath","last_synced_at":"2026-05-13T03:34:05.800Z","repository":{"id":138075986,"uuid":"292587963","full_name":"cxa/JPath","owner":"cxa","description":"Navigate JsonElement with a key path.","archived":false,"fork":false,"pushed_at":"2021-04-06T06:10:42.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-12T14:45:51.586Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"F#","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/cxa.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":"2020-09-03T14:07:29.000Z","updated_at":"2021-04-06T06:10:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"bd5dc568-78c7-4870-a13e-de043ed49634","html_url":"https://github.com/cxa/JPath","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cxa%2FJPath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cxa%2FJPath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cxa%2FJPath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cxa%2FJPath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cxa","download_url":"https://codeload.github.com/cxa/JPath/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241447526,"owners_count":19964314,"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":[],"created_at":"2024-11-13T07:18:28.525Z","updated_at":"2026-05-13T03:34:05.718Z","avatar_url":"https://github.com/cxa.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JPath\n\nNavigate JsonElement with a key path.\n\n(For navigating `System.Json`, use [KeyPathJson](https://github.com/cxa/KeyPathJson))\n\n## Install\n\nSimply drop `JPath.fsproj` or `JPath.fs` to your project, or search `JPath` on NuGet.\n\n## Example\n\nGiven a JSON like this:\n\n```json\n{\n  \"menu\": {\n    \"id\": \"file\",\n    \"value\": \"File\",\n    \"popup\": {\n      \"menuitems\": [\n        { \"value\": \"New\", \"onclick\": \"CreateNewDoc()\" },\n        { \"value\": \"Open\", \"onclick\": \"OpenDoc()\" },\n        { \"value\": \"Close\", \"onclick\": \"CloseDoc()\" }\n      ]\n    }\n  }\n}\n```\n\nSay if you need to access the second `menuitems`'s `value`, with `JPath` this is a piece of cake:\n\n```fsharp\nopen System.Text.Json\nopen JPath\n\nlet jdoc = JsonDocument.Parse jsonStr\n\n// result is `New`\nlet result =\n  jdoc.RootElement\n  |\u003e JPath.string \"menu.popup.menuitems.1.value\"\n```\n\nOne thing to notice is that you must use a number as a key to access an array, like `menuitems.1` in the above example.\n\nExcept accessing string, `KeyPathJson` also provides:\n\n```fsharp\nnamespace JPath\n  open System.Text.Json\n\n  module JPath = begin\n    val property :\n      keyPath:string -\u003e\n        jsonEl:JsonElement -\u003e JsonElement\n    val bool : (string -\u003e JsonElement -\u003e bool)\n    val byte : (string -\u003e JsonElement -\u003e byte)\n    val bytesFromBase64 : (string -\u003e JsonElement -\u003e byte [])\n    val dateTime : (string -\u003e JsonElement -\u003e System.DateTime)\n    val dateTimeOffset :\n      (string -\u003e JsonElement -\u003e System.DateTimeOffset)\n    val decimal : (string -\u003e JsonElement -\u003e decimal)\n    val double : (string -\u003e JsonElement -\u003e float)\n    val guid : (string -\u003e JsonElement -\u003e System.Guid)\n    val int16 : (string -\u003e JsonElement -\u003e int16)\n    val int32 : (string -\u003e JsonElement -\u003e int)\n    val int64 : (string -\u003e JsonElement -\u003e int64)\n    val rawText : (string -\u003e JsonElement -\u003e string)\n    val sbyte : (string -\u003e JsonElement -\u003e sbyte)\n    val single : (string -\u003e JsonElement -\u003e float32)\n    val float32 : (string -\u003e JsonElement -\u003e float32)\n    val string : (string -\u003e JsonElement -\u003e string)\n    val uint16 : (string -\u003e JsonElement -\u003e uint16)\n    val uint32 : (string -\u003e JsonElement -\u003e uint32)\n    val uint64 : (string -\u003e JsonElement -\u003e uint64)\n  end\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcxa%2Fjpath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcxa%2Fjpath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcxa%2Fjpath/lists"}