{"id":16442742,"url":"https://github.com/jilen/play-circe","last_synced_at":"2025-04-15T22:22:45.050Z","repository":{"id":2919516,"uuid":"45674914","full_name":"jilen/play-circe","owner":"jilen","description":"circe for play","archived":false,"fork":false,"pushed_at":"2024-09-29T01:20:19.000Z","size":330,"stargazers_count":108,"open_issues_count":10,"forks_count":21,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-12T09:18:34.450Z","etag":null,"topics":["circe","json","playframework"],"latest_commit_sha":null,"homepage":null,"language":"Scala","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/jilen.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":"2015-11-06T10:14:57.000Z","updated_at":"2024-09-14T06:25:05.000Z","dependencies_parsed_at":"2023-07-05T17:00:58.850Z","dependency_job_id":"e6058a58-6e5a-4b63-bdae-070d87f59ed3","html_url":"https://github.com/jilen/play-circe","commit_stats":{"total_commits":272,"total_committers":14,"mean_commits":"19.428571428571427","dds":0.4154411764705882,"last_synced_commit":"770c13da65d739d1ac44470bbe2516d58ccfb8f3"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jilen%2Fplay-circe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jilen%2Fplay-circe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jilen%2Fplay-circe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jilen%2Fplay-circe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jilen","download_url":"https://codeload.github.com/jilen/play-circe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249162042,"owners_count":21222585,"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":["circe","json","playframework"],"created_at":"2024-10-11T09:18:33.577Z","updated_at":"2025-04-15T22:22:45.031Z","avatar_url":"https://github.com/jilen.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"[Circe](https://github.com/travisbrown/circe) support for [playframework](https://playframework.com/)\n=====================================================================================================\n[![Build](https://github.com/jilen/play-circe/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/jilen/play-circe/actions/workflows/build.yml)\n[![codecov](https://codecov.io/gh/jilen/play-circe/branch/master/graph/badge.svg?token=SdVZrdCrzT)](https://codecov.io/gh/jilen/play-circe)\n\nHow to get it\n-------------\n\n- Add dependency\n\nFor play 2.6.x\n\n\u003e libraryDependencies += \"com.dripower\" %% \"play-circe\" % \"2612.0\"\n\nFor play 2.7.x\n\n\u003e libraryDependencies += \"com.dripower\" %% \"play-circe\" % \"2712.0\"\n\nFor play 2.8.x\n\n\u003e libraryDependencies += \"com.dripower\" %% \"play-circe\" % \"2814.1\"\n\nFor play 3.0.x\n\n\u003e libraryDependencies += \"com.dripower\" %% \"play-circe\" % \"3014.1\"\n\n\nUsage\n-----\n\n```scala\npackage play.api.libs.circe\n\nimport io.circe.generic.auto._\nimport io.circe.syntax._\nimport play.api._\nimport play.api.mvc._\n\nclass CirceController(val controllerComponents: ControllerComponents) extends BaseController with Circe {\n\n  case class Bar(bar: Int)\n  case class Foo(foo: String, bar: Bar)\n\n  val bar = Bar(1)\n  val foo = Foo(\"foo\", bar)\n\n  //serve json\n  def get = Action {\n    Ok(foo.asJson)\n  }\n\n  //parse json to case class\n  def post = Action(circe.json[Foo]) { implicit request =\u003e\n    val isEqual = request.body == foo\n    Ok(isEqual.toString)\n  }\n\n  def postJson = Action(circe.json) { implicit request =\u003e\n    val isEqual = request.body == foo.asJson\n    Ok(isEqual.toString)\n  }\n\n  def postTolerate = Action(circe.tolerantJson[Foo]) { implicit request =\u003e\n    val isEqual = request.body == foo\n    Ok(isEqual.toString)\n  }\n\n  def postTolerateJson = Action(circe.tolerantJson) { implicit request =\u003e\n    val isEqual = request.body == foo.asJson\n    Ok(isEqual.toString)\n  }\n}\n```\n\n# FAQ\n\n+ If you want to customize the json output, you can provide an implicit `Printer` in scope \n(default is `Printer.noSpaces`):\n\n```scala\nimport io.circe.Printer\n\nimplicit val customPrinter = Printer.spaces2.copy(dropNullValues = true)\n```\n\n+ The `Circe` totally ignores the configured `HttpErrorHandler` and just uses `DefaultHttpErrorHandler`.\nIf this not what you want, simply make a trait to override `circeErrorHandler` like this\n```scala\nclass MyController @Inject() (val errorHandler: HttpErrorHandler, val controllerComponents: ControllerComponents) extends BaseController with Circe {\n  override def circeErrorHandler = errorHandler\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjilen%2Fplay-circe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjilen%2Fplay-circe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjilen%2Fplay-circe/lists"}