Questions tagged [zio-json]
9 questions
3
votes
2 answers
How can I encode None to missing json field using zio-json instead of null?
Let's say I have a case class with the optional field nickName and codec like this:
final case class Person(name: String, nickName: Option[String])
object Person {
implicit val personCodec: JsonCodec[Person] = DeriveJsonCodec.gen
}
I want to…

mkUltra
- 2,828
- 1
- 22
- 47
2
votes
0 answers
How to decode this JSON with ZIO JSON?
With the following JSON, how to decode with ZIO JSON?
{
"substitutions": {
"BRANCH_NAME": "main",
"COMMIT_SHA": "e40addb0c8d8180ae3a13a470b6f3c56f2e2f29f",
"REF_NAME": "main",
"REPO_NAME": "data-query-service"
}
}

Phil
- 46,436
- 33
- 110
- 175
1
vote
1 answer
How to get a simple string encoding for Enumeratum enum in Zio-JSON
So lets say I have a simple enumeratum based enum.
import enumeratum._
sealed trait Fruit extends EnumEntry
object Fruit extends Enum[Fruit] {
override val values: IndexedSeq[Fruit] = findValues
case object Avocado extends Fruit
…

Peter Lamberg
- 8,151
- 3
- 55
- 69
1
vote
1 answer
ZioHttp end point - Return json response
I am creating a ZioHttp Rest endpoint...
For a Json request I want to return Json response ...
I'm able to retrun logs, print lines but not sure how to return json response...
Here's my code:
import zio.{Console, _}
import zhttp._
import…

Mohammed Mukhtar Ali
- 21
- 5
0
votes
0 answers
zio-json with io.estatico.newtype.macros.newtype
zio-json is unable to derive an encoder (using DeriveJsonEncoder.gen) for a case class with the @newtype annotation.
I'd rather not write even simple custom encoders for the hundreds of such classes we have. Is there any way, perhaps with some…

Bender Rodriguez
- 67
- 6
0
votes
0 answers
Scala, ZIO, Json - how to deserialize circe json response?
I have a strange problem with deserialization from external service. I have some lib where I call method and pass params. This method always returns zio.IO[Error, Value].
Inside this lib some magic happens, it connects with other service, get…

Developus
- 1,400
- 2
- 14
- 50
0
votes
1 answer
ZIO: How to return JSON ? [instead of using case class in ZIO-Http use schema to map?]
I tried directly getting body of JSON in code which I then want to convert to Avro to write to a kafka topic.
Here is my code with case class:
import zhttp.http._
import zio._
import zhttp.http.{Http, Method, Request, Response, Status}
import…

Mohammed Mukhtar Ali
- 21
- 5
0
votes
1 answer
Scala - Use uppercase first letter when decoding Json values with Zio JSON
I'm using Zio Json library to attempt to decode the following:
object BasicInfo {
private case class BasicInfoWire(
defaultPaymentMethod: DefaultPaymentMethod,
IdentityId__c: String,
sfContactId__c: String,
balance:…

Jon Flynn
- 440
- 6
- 15
0
votes
1 answer
ZIO Json: Failing Fiber on List in Json
I've got some data structures which I'm trying to hydrate from JSON. The short version (or the full version here):
sealed trait CexPair:
val timestamp: String
// ... (cut for brevity)
implicit val decoderCexPair: JsonDecoder[CexPair] =…

Aarkon
- 484
- 1
- 6
- 16