{"id":20010097,"url":"https://github.com/cxa/keypathjson","last_synced_at":"2026-06-07T02:31:58.593Z","repository":{"id":138076013,"uuid":"120407085","full_name":"cxa/KeyPathJson","owner":"cxa","description":"Safe and key-path-able JSON navigator for System.Json","archived":false,"fork":false,"pushed_at":"2020-09-03T14:09:47.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-12T14:45:50.624Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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":"2018-02-06T05:39:27.000Z","updated_at":"2021-01-22T05:05:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"25608a31-6f0c-46ff-8abb-c4cadab84991","html_url":"https://github.com/cxa/KeyPathJson","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%2FKeyPathJson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cxa%2FKeyPathJson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cxa%2FKeyPathJson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cxa%2FKeyPathJson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cxa","download_url":"https://codeload.github.com/cxa/KeyPathJson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241447520,"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.013Z","updated_at":"2025-03-02T01:44:57.740Z","avatar_url":"https://github.com/cxa.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KeyPathJson\n\nSafe and key-path-able JSON navigator for `System.Json`.\n\n(For navigating `System.Text.Json`, use [JPath](https://github.com/cxa/JPath))\n\n## Install\n\nSimply drop `KeyPathJson.fsproj` or `KeyPathJson.fs` to your project, or search `KeyPathJson` 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      \"menuitem\": [\n        { \"value\": \"New\", \"onclick\": \"CreateNewDoc()\" },\n        { \"value\": \"Open\", \"onclick\": \"OpenDoc()\" },\n        { \"value\": \"Close\", \"onclick\": \"CloseDoc()\" }\n      ]\n    }\n  }\n}\n```\n\nSay you need to access the second `menuitem`'s `value`, with `KeyPathJson` this is a piece of cake:\n\n```fsharp\nopen KeyPathJson\n\n// result is a Result\u003cstring, exn\u003e\nlet result =\n  Json.parse jsonStr\n  |\u003e Json.string \"menu.popup.menuitem.1.value\"\n\n```\n\nOne thing to aware is that you must use a number as a key to access array, like `menuitem.1` in the above example.\n\nExcept accessing string, `KeyPathJson` also provides:\n\n```fsharp\nval value :\n      keyPath:string -\u003e\n        jsonValue:JsonValue -\u003e Result\u003cJsonValue,exn\u003e\n\nval bool :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003cbool,exn\u003e\n\nval byte :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003cbyte,exn\u003e\n\nval sbyte :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003csbyte,exn\u003e\n\nval int8 :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003cint8,exn\u003e\n\nval uint8 :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003cuint8,exn\u003e\n\nval int16 :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003cint16,exn\u003e\n\nval uint16 :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003cuint16,exn\u003e\n\nval int32 :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003cint,exn\u003e\n\nval uint32 :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003cuint32,exn\u003e\n\nval int64 :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003cint64,exn\u003e\n\nval uint64 :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003cuint64,exn\u003e\n\nval decimal :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003cdecimal,exn\u003e\n\nval double :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003cdouble,exn\u003e\n\nval float32 :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003cfloat32,exn\u003e\n\nval char :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003cchar,exn\u003e\n\nval string :\n  keyPath:string -\u003e jsonValue:JsonValue -\u003e Result\u003cstring,exn\u003e\n\nval dateTime :\n  keyPath:string -\u003e\n    jsonValue:JsonValue -\u003e Result\u003cSystem.DateTime,exn\u003e\n\nval dateTimeOffset :\n  keyPath:string -\u003e\n    jsonValue:JsonValue -\u003e Result\u003cSystem.DateTimeOffset,exn\u003e\n\nval guid :\n  keyPath:string -\u003e\n    jsonValue:JsonValue -\u003e Result\u003cSystem.Guid,exn\u003e\n\nval timeSpan :\n  keyPath:string -\u003e\n    jsonValue:JsonValue -\u003e Result\u003cSystem.TimeSpan,exn\u003e\n\nval uri :\n  keyPath:string -\u003e\n    jsonValue:JsonValue -\u003e Result\u003cSystem.Uri,exn\u003e\n```\n\nThat's all.\n\n## Usage\n\nDrag `src/KeyPathJson.fs` to your project or get it from NuGet: \u003chttps://www.nuget.org/packages/KeyPathJson/\u003e\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcxa%2Fkeypathjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcxa%2Fkeypathjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcxa%2Fkeypathjson/lists"}