{"id":26076834,"url":"https://github.com/purescript-contrib/purescript-argonaut-core","last_synced_at":"2025-03-09T02:36:11.883Z","repository":{"id":1069839,"uuid":"38894898","full_name":"purescript-contrib/purescript-argonaut-core","owner":"purescript-contrib","description":"A fast, native representation for JSON, with serialization and folding","archived":false,"fork":false,"pushed_at":"2024-02-16T19:37:45.000Z","size":155,"stargazers_count":48,"open_issues_count":4,"forks_count":30,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-02-19T09:07:35.605Z","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-07-10T18:06:56.000Z","updated_at":"2024-10-31T09:35:07.000Z","dependencies_parsed_at":"2022-08-07T03:00:01.827Z","dependency_job_id":"f1a4e657-5081-494d-b7d9-1e2e108d6449","html_url":"https://github.com/purescript-contrib/purescript-argonaut-core","commit_stats":{"total_commits":74,"total_committers":22,"mean_commits":"3.3636363636363638","dds":0.6891891891891893,"last_synced_commit":"68da81dd80ec36d3b013eff46dc067a972c22e5d"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-contrib%2Fpurescript-argonaut-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-contrib%2Fpurescript-argonaut-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-contrib%2Fpurescript-argonaut-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-contrib%2Fpurescript-argonaut-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/purescript-contrib","download_url":"https://codeload.github.com/purescript-contrib/purescript-argonaut-core/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242635336,"owners_count":20161437,"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:36:11.369Z","updated_at":"2025-03-09T02:36:11.875Z","avatar_url":"https://github.com/purescript-contrib.png","language":"PureScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Argonaut Core\n\n[![CI](https://github.com/purescript-contrib/purescript-argonaut-core/workflows/CI/badge.svg?branch=main)](https://github.com/purescript-contrib/purescript-argonaut-core/actions?query=workflow%3ACI+branch%3Amain)\n[![Release](http://img.shields.io/github/release/purescript-contrib/purescript-argonaut-core.svg)](https://github.com/purescript-contrib/purescript-argonaut-core/releases)\n[![Pursuit](http://pursuit.purescript.org/packages/purescript-argonaut-core/badge)](http://pursuit.purescript.org/packages/purescript-argonaut-core)\n[![Maintainer: garyb](https://img.shields.io/badge/maintainer-garyb-teal.svg)](http://github.com/garyb)\n\nThe core `Json` type for the [Argonaut](https://github.com/purescript-contrib/purescript-argonaut) libraries, along with basic parsing, printing, and folding functions which operate on it.\n\n## Installation\n\nInstall `argonaut-core` with [Spago](https://github.com/purescript/spago):\n\n```sh\nspago install argonaut-core\n```\n\nor install it as part of the [Argonaut](https://github.com/purescript-contrib/purescript-argonaut) bundle:\n\n```sh\nspago install argonaut\n```\n\n## Quick start\n\nUse the `Json` type to represent JSON data in PureScript. You can produce a value of `Json` via the FFI or by functions from `Data.Argonaut.Core`.\n\nFor example, via the FFI:\n\n```js\n// In an FFI module\nexports.someNumber = 23.6;\nexports.someObject = { people: [{ name: \"John\" }, { name: \"Jane\" }] };\n```\n\n```purs\nforeign import someNumber :: Json\nforeign import someObject :: Json\n```\n\nIn general, if a JavaScript value could be returned from a call to `JSON.parse` then you can import it via the FFI as `Json`. That includes objects, booleans, numbers, strings, and arrays (but not things like functions).\n\nYou can also use the construction functions which follow the naming convention `fromX` or `jsonX`:\n\n```purs\nimport Data.Tuple (Tuple(..))\nimport Foreign.Object as Object\nimport Data.Argonaut.Core as A\n\nsomeNumber :: Json\nsomeNumber = A.fromNumber 23.6\n\nsomeObject :: Json\nsomeObject =\n  A.fromObject\n    ( Object.fromFoldable\n        [ Tuple \"people\"\n            ( A.fromArray\n                [ A.jsonSingletonObject \"name\" (A.fromString \"John\")\n                , A.jsonSingletonObject \"name\" (A.fromString \"Jane\")\n                ]\n            )\n        ]\n    )\n```\n\nFinally, you can parse JSON from a string using the `jsonParser` function. However, this isn't guaranteed to produce a correct value, so it returns an `Either` value, where a parsing error is represented with `Left` containing an error message.\n\n```purs\nimport Data.Argonaut.Parser (jsonParser)\nimport Data.Maybe (Maybe(..))\n\nsomeObject :: Either String Json\nsomeObject = jsonParser\n  \"\"\"\n  { people: [{ name: \"John\" }, { name: \"Jane\" }] };\n  \"\"\"\n```\n\nSee the [docs](./docs) for an in-depth overview of the rest of the Argonaut Core library. You may also be interested in other libraries in the Argonaut ecosystem:\n\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-traversals](https://github.com/purescript-contrib/purescript-argonaut-traversals) defines prisms, traversals, and zippers for the `Json` type.\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-core` documentation is stored in a few places:\n\n1. Module documentation is [published on Pursuit](https://pursuit.purescript.org/packages/purescript-argonaut-core).\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-core/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-core` 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-core/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-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpurescript-contrib%2Fpurescript-argonaut-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurescript-contrib%2Fpurescript-argonaut-core/lists"}