argonaut

    1熱度

    1回答

    我喜歡在我的案例類中使用casecodecN或無定形解碼器,但是其中一個字段在使用json時具有不同的類型。 考慮,其中b在json中是一個類似於"1.23"的字符串,但我希望它是Double。 case class Foo(a: Double, b: Double) 如果我使用casecodec2就會報錯,因爲b是一個字符串 casecodec2(Foo.apply, Foo.unapply

    1熱度

    1回答

    我想發送一個帶有JSON格式正文消息的Http錯誤響應。我無法使用PredefinedToResponseMarshallers。 我在Akka docs看到了一個實現,但我嘗試了類似的東西,它會引發編譯錯誤。 import argonaut._, Argonaut._ import akka.http.scaladsl.marshalling.Marshal import akka.http

    0熱度

    1回答

    我使用Finagle/Finch和我得到這個錯誤: diverging implicit expansion for type argonaut.DecodeJson[A] starting with method MapDecodeJson in trait DecodeJsons diverging implicit expansion for type argonaut.Deco

    3熱度

    1回答

    我試圖寫一個DecodeJson[T]的JSON對象包含一個不同「類型」(意即其元素的JSON結構不同)的數組。唯一的共同特點是type字段可用於區分類型。所有其他領域是不同的。例如: { ..., array: [ { type: "a", a1: ..., a2: ...}, { type: "b", b1: ...}, { type:

    2熱度

    1回答

    我有JSON格式與一堆話轉錄在它 { "words": [{ "duration": 123, "name": "world" "time": 234, "speaker": null }] } 我已經使用瑟茜編碼/解碼JSON。在這種特殊情況下: import io.circe.generic.auto._ i

    0熱度

    2回答

    我試圖封送阿卡HttpResponse這樣: { "code": 200, "headers": [], "body": "{\"data\": \"Yes!\"}" } 如果我寫的淘金EncodeJson對於這種情況下,它可能是這樣的: implicit def httpResponseEncodeJson: EncodeJson[HttpResponse]

    4熱度

    1回答

    使用circe或argonaut,我怎麼能寫一個Json => A(注 - Json可能不是類型的名稱),其中A由SSN類給出: // A USA Social Security Number has exactly 8 digits. case class SSN(value: Sized[List[Nat], _8]) ? 僞代碼: // assuming this functi

    2熱度

    1回答

    我試圖從Haskell服務器獲取一些JSON數據,但我遇到了Respondeable實例,以及一般Affjax的問題​​。我已經使用Data.Argonaut.Generic.Aeson(GA)定義了EncodeJson + DecodeJson,但我無法弄清楚如何將它與Respondeable實例相匹配,並且它來自ResponseResponse函數。 它給了我錯誤「無法與Json類型匹配類型外

    0熱度

    1回答

    考慮: import argonaut._ import Argonaut._ import ArgonautShapeless._ sealed trait Parent case class Foo(x: Int) extends Parent case class Bar(y: String) extends Parent 我試圖定義DecodeJson[Parent]: i

    2熱度

    2回答

    考慮: import argonaut._, Argonaut._ case class Person(name: String) implicit def decode: DecodeJson[Person] = DecodeJson (c => for { name <- (c --\ "name").as[String] } yield Pe