{"id":16660942,"url":"https://github.com/agrafix/highjson","last_synced_at":"2025-03-21T17:31:45.205Z","repository":{"id":35137132,"uuid":"39349489","full_name":"agrafix/highjson","owner":"agrafix","description":"Haskell: Low boilerplate, easy to use and very fast Haskell JSON serialisation and parsing ","archived":false,"fork":false,"pushed_at":"2021-05-17T02:47:58.000Z","size":117,"stargazers_count":11,"open_issues_count":2,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-05-29T20:26:01.028Z","etag":null,"topics":["haskell","json","swagger"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agrafix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-19T21:24:38.000Z","updated_at":"2023-11-07T13:44:42.000Z","dependencies_parsed_at":"2022-09-09T04:11:25.451Z","dependency_job_id":null,"html_url":"https://github.com/agrafix/highjson","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrafix%2Fhighjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrafix%2Fhighjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrafix%2Fhighjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrafix%2Fhighjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agrafix","download_url":"https://codeload.github.com/agrafix/highjson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221817141,"owners_count":16885469,"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":["haskell","json","swagger"],"created_at":"2024-10-12T10:32:30.777Z","updated_at":"2024-10-28T10:31:28.702Z","avatar_url":"https://github.com/agrafix.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"highjson\n=====\n\n[![Hackage Deps](https://img.shields.io/hackage-deps/v/highjson.svg)](http://packdeps.haskellers.com/reverse/highjson)\n\n## Intro\n\nHackage: [highjson](http://hackage.haskell.org/package/highjson)\n\nLow boilerplate, easy to use and very fast Haskell JSON serialisation and\nparsing without the help of TemplateHaskell or Generics built on top of [aeson](http://hackage.haskell.org/package/aeson). The optional package `highjson-swagger` will also help automatically generating a OpenAPI schema.\n\n## Usage\n\n```haskell\n{-# LANGUAGE OverloadedStrings #-}\n{-# LANGUAGE PartialTypeSignatures #-}\nimport Data.Aeson\nimport Data.HighJson\n\nimport Data.HighJson.Swagger -- optional\nimport Data.Swagger -- optional\n\ndata SomeDummy\n   = SomeDummy\n   { sd_int :: Int\n   , sd_bool :: Bool\n   , sd_text :: T.Text\n   , sd_either :: Either Bool T.Text\n   , sd_maybe :: Maybe Int\n   } deriving (Show, Eq)\n\nsomeDummySpec :: RecordTypeSpec SomeDummy _\nsomeDummySpec =\n    recSpec \"Some Dummy\" Nothing SomeDummy $\n    \"int\" .= sd_int\n    :\u0026 \"bool\" .= sd_bool\n    :\u0026 \"text\" .= sd_text\n    :\u0026 \"either\" .= sd_either\n    :\u0026 \"maybe\" .= sd_maybe\n\ninstance ToJSON SomeDummy where\n    toJSON = jsonSerializer someDummySpec\n    toEncoding = jsonEncoder someDummySpec\n\ninstance FromJSON SomeDummy where\n    parseJSON = jsonParser someDummySpec\n\ninstance ToSchema SomeSum where -- optional, generates swagger2 specifications\n    declareNamedSchema p = makeDeclareNamedSchema someDummySpec p\n\ntest =\n    decodeEither \"{\\\"int\\\": 34, \\\"text\\\": \\\"Teext\\\", \\\"bool\\\": true}\"\n        == Right (SomeDummy 34 True \"Teext\" Nothing)\n```\n\n### Template haskell\n\nThere's also a small shortcut via template haskell (`highjson-th`):\n\n```haskell\n{-# LANGUAGE OverloadedStrings #-}\n{-# LANGUAGE PartialTypeSignatures #-}\n{-# LANGUAGE TemplateHaskell #-}\nimport Data.HighJson\nimport Data.HighJson.Swagger\nimport Data.HighJson.TH\n\ndata SomeDummy\n   = SomeDummy\n   { sd_int :: Int\n   , sd_bool :: Bool\n   , sd_text :: T.Text\n   , sd_either :: Either Bool T.Text\n   , sd_maybe :: Maybe Int\n   } deriving (Show, Eq)\n\nsomeDummySpec :: RecordTypeSpec SomeDummy _\nsomeDummySpec =\n    recSpec \"Some Dummy\" Nothing SomeDummy $\n    \"int\" .= sd_int\n    :\u0026 \"bool\" .= sd_bool\n    :\u0026 \"text\" .= sd_text\n    :\u0026 \"either\" .= sd_either\n    :\u0026 \"maybe\" .= sd_maybe\n\n$(deriveJsonSwagger ''SomeDummy 'someDummySpec)\n\ntest =\n    decodeEither \"{\\\"int\\\": 34, \\\"text\\\": \\\"Teext\\\", \\\"bool\\\": true}\"\n        == Right (SomeDummy 34 True \"Teext\" Nothing)\n```\n\n### Tests\n\nFor more usage examples check the tests.\n\n## Install\n\n* Using cabal: `cabal install highjson`\n* From Source: `git clone https://github.com/agrafix/highjson.git \u0026\u0026 cd highjson \u0026\u0026 cabal install`\n\n## Benchmarks\n\nThere are benchmarks in the project and it is expected to be en par or faster than `aeson`s generic instances.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagrafix%2Fhighjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagrafix%2Fhighjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagrafix%2Fhighjson/lists"}