{"id":20059554,"url":"https://github.com/monix/monix-circe","last_synced_at":"2025-03-02T09:44:13.709Z","repository":{"id":57735893,"uuid":"185631190","full_name":"monix/monix-circe","owner":"monix","description":"Streaming JSON parsing for circe with Monix Observable","archived":false,"fork":false,"pushed_at":"2020-06-26T07:46:13.000Z","size":35,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-12T22:10:45.105Z","etag":null,"topics":[],"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/monix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-08T15:17:09.000Z","updated_at":"2021-12-04T16:22:57.000Z","dependencies_parsed_at":"2022-08-24T14:57:18.453Z","dependency_job_id":null,"html_url":"https://github.com/monix/monix-circe","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monix%2Fmonix-circe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monix%2Fmonix-circe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monix%2Fmonix-circe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monix%2Fmonix-circe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monix","download_url":"https://codeload.github.com/monix/monix-circe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241488156,"owners_count":19970827,"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":"2024-11-13T13:08:19.286Z","updated_at":"2025-03-02T09:44:13.683Z","avatar_url":"https://github.com/monix.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Streaming JSON parsing for circe with Monix Observable [![Build Status](https://travis-ci.org/monix/monix-circe.svg?branch=master)](https://travis-ci.org/monix/monix-circe) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.monix/monix-circe_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.monix/monix-circe_2.12)\n\n## Quick Start\n\nTo use monix-circe in an existing SBT project with Scala 2.12 or a later version, add the following dependencies to your\n`build.sbt` depending on your needs:\n\n```scala\nlibraryDependencies ++= Seq(\n  \"io.monix\" %% \"monix-circe\" % \"0.0.3\"\n)\n```\n\n## Parsing\n\nMonix-Circe provides different pipes to parse your streams of JSONs depending on whether your `Observable`\nis:\n\n- a \\n-separated stream of JSON values or value stream:\n\n```json\n{ \"repo\": \"monix-circe\", \"stars\": 14 }\n{ \"repo\": \"monix-config\", \"stars\": 5 }\n```\n\n- or a JSON array:\n\n```json\n[\n  { \"repo\": \"monix-circe\", \"stars\": 14 },\n  { \"repo\": \"monix-config\", \"stars\": 5 }\n]\n```\n\nThe appropriate `Operator` for the job also depends on your input stream value type (i.e. `String` or `Byte`).\n\nThe following table sums up every `Operator` available as a function of the input stream value type as\nwell as the JSON structure:\n\n|                |String              |Byte              |\n|----------------|--------------------|------------------|\n|__Value stream__|`stringStreamParser`|`byteStreamParser`|\n|__Array__       |`stringArrayParser` |`byteArrayParser` |\n\nAs an example, let's say we have a stream of strings representing a JSON array, we'll\npick the `stringArrayParser` pipe which converts a stream of `String` to a stream of `Json`, Circe's\nrepresentation of JSONs:\n\n```scala\nimport io.circe.Json\nimport monix.circe._\nimport monix.reactive.Observable\n\nval stringStream: Observable[String] = ???\nval parsedStream: Observable[Json] = stringStream.liftByOperator(stringArrayParser)\n```\n\n## Decoding\n\nMonix-Circe also comes with a `decoder` function which, given a `Decoder[A]`, produces a\n`Observable[Json] =\u003e Observable[A]`.\n\nFor example, using Circe's fully automatic derivation:\n\n```scala\nimport io.circe.generic.auto._\ncase class Foo(a: Int, b: String)\nval parsedStream: Observable[Json] = ???\nval decodedStream: Observable[Foo] = parsedStream.liftByOperator(decoder[Foo])\n```\n\n## Acknowledgements\n\nHeavily inspired/based on [circe-fs2](https://github.com/circe/circe-fs2) and [circe-iteratee](https://github.com/circe/circe-iteratee).\n\n## License\n\nAll code in this repository is licensed under the Apache License,\nVersion 2.0.  See [LICENSE.txt](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonix%2Fmonix-circe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonix%2Fmonix-circe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonix%2Fmonix-circe/lists"}