{"id":26076806,"url":"https://github.com/purescript-contrib/purescript-argonaut-traversals","last_synced_at":"2025-12-16T02:08:59.189Z","repository":{"id":1077906,"uuid":"38894925","full_name":"purescript-contrib/purescript-argonaut-traversals","owner":"purescript-contrib","description":"Prisms, traversals, and zipper for the Argonaut Json type.","archived":false,"fork":false,"pushed_at":"2022-04-27T23:09:45.000Z","size":116,"stargazers_count":11,"open_issues_count":4,"forks_count":16,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-02-08T20:01:42.553Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PureScript","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/purescript-contrib.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-10T18:07:36.000Z","updated_at":"2023-02-06T12:06:44.000Z","dependencies_parsed_at":"2022-08-07T03:00:02.215Z","dependency_job_id":null,"html_url":"https://github.com/purescript-contrib/purescript-argonaut-traversals","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-contrib%2Fpurescript-argonaut-traversals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-contrib%2Fpurescript-argonaut-traversals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-contrib%2Fpurescript-argonaut-traversals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-contrib%2Fpurescript-argonaut-traversals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/purescript-contrib","download_url":"https://codeload.github.com/purescript-contrib/purescript-argonaut-traversals/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242608462,"owners_count":20157360,"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":"2025-03-09T02:35:41.406Z","updated_at":"2025-12-16T02:08:54.129Z","avatar_url":"https://github.com/purescript-contrib.png","language":"PureScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Argonaut Traversals\n\n[![CI](https://github.com/purescript-contrib/purescript-argonaut-traversals/workflows/CI/badge.svg?branch=main)](https://github.com/purescript-contrib/purescript-argonaut-traversals/actions?query=workflow%3ACI+branch%3Amain)\n[![Release](http://img.shields.io/github/release/purescript-contrib/purescript-argonaut-traversals.svg)](https://github.com/purescript-contrib/purescript-argonaut-traversals/releases)\n[![Pursuit](http://pursuit.purescript.org/packages/purescript-argonaut-traversals/badge)](http://pursuit.purescript.org/packages/purescript-argonaut-traversals)\n[![Maintainer: garyb](https://img.shields.io/badge/maintainer-garyb-teal.svg)](http://github.com/garyb)\n\nPrisms, traversals, and zipper for the `Json` type. Part of the [Argonaut](https://github.com/purescript-contrib/purescript-argonaut) collection of libraries for working with JSON in PureScript.\n\n## Installation\n\nInstall `argonaut-traversals` with [Spago](https://github.com/purescript/spago):\n\n```sh\nspago install argonaut-traversals\n```\n\nor install as part of the Argonaut bundle:\n\n```sh\nspago install argonaut\n```\n\n## Quick start\n\nYou can use the prisms defined in `Data.Argonaut.Prisms` with functions from the [`profunctor-lenses`](https://github.com/purescript-contrib/purescript-profunctor-lenses) library to work with nested `Json` structures. For example:\n\n```js\n// FFI file\nexports.sampleJson = { \"a\": { \"b\": [ 10, 11, 12 ] } }\n```\n\n```purs\nmodule Main where\n\nimport Prelude\n\nimport Effect (Effect)\nimport Data.Argonaut.Core (Json)\nimport Data.Argonaut.Prisms (_Array, _Number, _Object)\nimport Data.Maybe (Maybe(..))\nimport Data.Lens (preview)\nimport Data.Lens.Index (ix)\nimport Effect.Console (log)\n\nforeign import sampleJson :: Json\n\nmain :: Effect Unit\nmain =\n  -- Walk through an object at the key 'a', then an object at the key 'b', then\n  -- get the first index of an array as a number.\n  case preview (_Object \u003c\u003c\u003c ix \"a\" \u003c\u003c\u003c _Object \u003c\u003c\u003c ix \"b\" \u003c\u003c\u003c _Array \u003c\u003c\u003c ix 0 \u003c\u003c\u003c _Number) sampleJson of\n    Nothing -\u003e log \"nothin' there\"\n    Just v -\u003e log $ \"This should be 10.0 \" \u003c\u003e show v\n```\n\nYou may also be interested in other libraries in the Argonaut ecosystem:\n\n- [purescript-argonaut-core](https://github.com/purescript-contrib/purescript-argonaut-core) defines the `Json` type, along with basic parsing, printing, and folding functions\n- [purescript-argonaut-codecs](https://github.com/purescript-contrib/purescript-argonaut-codecs) provides codecs based on `EncodeJson` and `DecodeJson` type classes, along with instances for common data types and combinators for encoding and decoding `Json` values.\n- [purescript-codec-argonaut](https://github.com/garyb/purescript-codec-argonaut) supports an alternative approach for codecs, which are based on profunctors instead of type classes.\n- [purescript-argonaut-generic](https://github.com/purescript-contrib/purescript-argonaut-generic) supports generic encoding and decoding for any type with a `Generic` instance.\n\n## Documentation\n\n`argonaut-traversals` documentation is stored in a few places:\n\n1. Module documentation is [published on Pursuit](https://pursuit.purescript.org/packages/purescript-argonaut-traversals).\n2. Written documentation is kept in [the docs directory](./docs).\n3. Usage examples can be found in [the test suite](./test).\n\nIf you get stuck, there are several ways to get help:\n\n- [Open an issue](https://github.com/purescript-contrib/purescript-argonaut-traversals/issues) if you have encountered a bug or problem.\n- Ask general questions on the [PureScript Discourse](https://discourse.purescript.org) forum or the [PureScript Discord](https://purescript.org/chat) chat.\n\n## Contributing\n\nYou can contribute to `argonaut-traversals` in several ways:\n\n1. If you encounter a problem or have a question, please [open an issue](https://github.com/purescript-contrib/purescript-argonaut-traversals/issues). We'll do our best to work with you to resolve or answer it.\n\n2. If you would like to contribute code, tests, or documentation, please [read the contributor guide](./CONTRIBUTING.md). It's a short, helpful introduction to contributing to this library, including development instructions.\n\n3. If you have written a library, tutorial, guide, or other resource based on this package, please share it on the [PureScript Discourse](https://discourse.purescript.org)! Writing libraries and learning resources are a great way to help this library succeed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurescript-contrib%2Fpurescript-argonaut-traversals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpurescript-contrib%2Fpurescript-argonaut-traversals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurescript-contrib%2Fpurescript-argonaut-traversals/lists"}