{"id":15392963,"url":"https://github.com/pimbrouwers/jay","last_synced_at":"2025-10-07T21:34:42.567Z","repository":{"id":53082825,"uuid":"256032548","full_name":"pimbrouwers/Jay","owner":"pimbrouwers","description":"An F# JSON parser \u0026 serializer","archived":false,"fork":false,"pushed_at":"2023-03-25T10:28:17.000Z","size":66,"stargazers_count":12,"open_issues_count":4,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-04T20:17:54.650Z","etag":null,"topics":["json","json-parser","json-parsing","json-serialization","json-serialization-library","json-serializer"],"latest_commit_sha":null,"homepage":"","language":"F#","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/pimbrouwers.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-04-15T20:45:05.000Z","updated_at":"2024-09-14T19:29:14.000Z","dependencies_parsed_at":"2024-10-19T01:07:12.742Z","dependency_job_id":null,"html_url":"https://github.com/pimbrouwers/Jay","commit_stats":{"total_commits":26,"total_committers":3,"mean_commits":8.666666666666666,"dds":0.5384615384615384,"last_synced_commit":"4480808914c8a5478c6d145d53db08b8162855ab"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimbrouwers%2FJay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimbrouwers%2FJay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimbrouwers%2FJay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimbrouwers%2FJay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pimbrouwers","download_url":"https://codeload.github.com/pimbrouwers/Jay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240356060,"owners_count":19788512,"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":["json","json-parser","json-parsing","json-serialization","json-serialization-library","json-serializer"],"created_at":"2024-10-01T15:16:51.886Z","updated_at":"2025-10-07T21:34:42.473Z","avatar_url":"https://github.com/pimbrouwers.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jay\n\n[![NuGet Version](https://img.shields.io/nuget/v/Jay.svg)](https://www.nuget.org/packages/Jay)\n[![build](https://github.com/pimbrouwers/Jay/actions/workflows/build.yml/badge.svg)](https://github.com/pimbrouwers/Jay/actions/workflows/build.yml)\n\nThe aim of this library was to take the core JSON parser from the amazing [FSharp.Data](https://github.com/fsharp/FSharp.Data/) project, and modernize/simplify it's API.\n\n## Key Features\n\n- Parse JSON from strings, streams, and files.\n- Simple and powerful JSON syntax tree.\n- Easy conversion between JSON and F# record types.\n- Support for primitive type conversions (e.g., `AsString`, `AsInt64`, `AsDateTimeOffset`).\n\n## Design Goals\n\n- Provide a simple means for working with complex JSON structures in F#.\n- Define an abstract syntax tree (AST) for JSON that is easy to work with.\n- Support for parsing JSON from strings, streams, and files.\n\n## Getting Started\n\nInstall the [Jay](https://www.nuget.org/packages/Jay/) NuGet package:\n\n```\nPM\u003e Install-Package Jay\n```\n\nOr using the dotnet CLI\n```cmd\ndotnet add package Jay\n```\n\n## An Example\n\nLet's consider a stripped down [Tweet object](https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/tweet-object).\n\n\u003e Note: the `user` and `entities` properties have been removed for clarity.\n\n```json\n{\n \"created_at\": \"Wed Oct 10 20:19:24 +0000 2018\",\n \"id\": 1050118621198921728,\n \"id_str\": \"1050118621198921728\",\n \"text\": \"To make room for more expression, we will now count all emojis as equal—including those with gender‍‍‍ ‍‍and skin t… https://t.co/MkGjXf9aXm\",\n}\n```\n\nIn order to work with this in our F# program, we'll first need to create a [record type](https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/records).\n\n```f#\ntype Tweet =\n    {\n        CreatedAt : DateTimeOffset\n        Id        : int64\n        IdStr     : string\n        Text      : string\n    }\n```\n\nNext we'll define a module with the same name, `Tweet`, and a function called `fromJson` to consume our JSON and return a `Tweet` record.\n\n```f#\ntype Tweet =\n    {\n        CreatedAt : DateTimeOffset\n        Id        : int64\n        IdStr     : string\n        Text      : string\n    }\n\nmodule Tweet =\n    let fromJson (json : Json) =\n        {\n            CreatedAt = json?created_at.AsDateTimeOffset()\n            Id        = json?id.AsInt64()\n            IdStr     = json?idStr.AsString()\n            Text      = json?text.AsString()\n        }\n\n\nlet tweetJson = ... // JSON from above\nlet tweet =\n    tweetJson\n    |\u003e Json.parse\n    |\u003e Tweet.fromJson\n```\n\nFinally, we'll create another function `toJson` to convert our record back into JSON represented as an [abstract syntax tree](https://en.wikipedia.org/wiki/Abstract_syntax_tree).\n\n```f#\ntype Tweet =\n    {\n        CreatedAt : DateTimeOffset\n        Id        : int64\n        IdStr     : string\n        Text      : string\n    }\n\nmodule Tweet =\n    let fromJson (json : Json) =\n        {\n            CreatedAt = json?created_at.AsDateTimeOffset()\n            Id        = json?id.AsInt64()\n            IdStr     = json?idStr.AsString()\n            Text      = json?text.AsString()\n        }\n\n    let toJson (tweet : Tweet) =\n        JObject\n            [|\n                \"created_at\", JString (tweet.CreatedAt.ToString())\n                \"id\",         JNumber (float tweet.Id)\n                \"id_str\",     JString tweet.IdStr\n                \"text\",       JString tweet.Text\n            |]\n\nlet tweetJson = ... // JSON from above\nlet tweet =\n    tweetJson\n    |\u003e Json.parse\n    |\u003e Tweet.fromJson\n\nlet json =\n    tweet\n    |\u003e Tweet.toJson\n    |\u003e Json.serialize\n```\n\nAnd that's it!\n\n## Find a bug?\n\nThere's an [issue](https://github.com/pimbrouwers/Jay/issues) for that.\n\n## License\n\nLicensed under [MIT](https://github.com/pimbrouwers/Jay/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpimbrouwers%2Fjay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpimbrouwers%2Fjay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpimbrouwers%2Fjay/lists"}