Questions tagged [argonaut]

Argonaut is a JSON library for Scala, providing a rich library for parsing, printing and manipulation as well as convenient codecs for translation to and from scala data types.

About

Argonaut is a JSON library for Scala, providing a rich library for parsing, printing and manipulation as well as convenient codecs for translation to and from scala data types.

Argonaut is licenced under BSD3 (see LICENCE).

Links

88 questions
1
vote
1 answer

How to convert a json value "aaa,bbb" to a "Seq[String]" with argonaut?

I'm using argonaut to parse json to case classes. Json: { "name" : "Mike", "email" : "a@aaa.com, b@bbb.com" } Scala: case class User(agentName: String, emails: Seq[String]) object User { implicit def DecodeJson: DecodeJson[User] = …
Freewind
  • 193,756
  • 157
  • 432
  • 708
1
vote
1 answer

How to reverse the fields order when generate JSON with argonaut?

With argonaut, I can generate some JSON as: def toJson(user:User) = ("id" := user.id) ->: ("name" := user.name) ->: jEmptyObject But it will generate json with reversed order: { "name": "myname", "id": "123" } Actually I want it to be: { …
Freewind
  • 193,756
  • 157
  • 432
  • 708
1
vote
1 answer

Json Argonaut Too Big For Case Class

There's an API I have no influence on that has a JSON result object with a member that has 23 fields. The paradigm of case classes doesn't work, because there's a limit of 22. I've seen Slick and other libraries use HLists to resolve this. Is…
jordan3
  • 877
  • 5
  • 13
1
vote
2 answers

Deep Merge JSON Data

Is it possible to deep merge a JSON Structure using lift JSON , argonaut , etc { "metrics": [{ "name": "abcde", "tags": { "oId": ["pqrs"], "uuid": ["A123-B234"], "entityType": ["test"], "entityName": ["test"] …
user2780187
  • 677
  • 7
  • 16
0
votes
1 answer

Scala Argonaut folding across a list?

I'm very new to Argonaut (which I'm forced to use since the codebase is older, using an old version of scalaz, and we have no intentions to update it since we're rewriting this outdated code from scratch), and I'm trying to find a way to dump some…
Sebastian
  • 715
  • 6
  • 13
0
votes
1 answer

Raising Argonaut tuple arity to 23

I'm trying to implement a CodecJson with arity 23. It looks something like this: implicit def infoCodec: CodecJson[Info] = CodecJson( (x: Info) => argonaut.Json( "a" -> x.a, "b" -> x.b, "c" -> x.c, ...(a total of 23…
mmmmust
  • 15
  • 5
0
votes
2 answers

How to get better error messages when parsing JSON with Argonaut and custom codecs

I'm using Argonaut to parse JSON with my custom codecs. My code looks like this: val json: String = ... val parsed = Parse.decodeEither[MyClass](json) val checks = if (parsed.isRight) parsed.right.get else sys.error("Unable to parse MyClass json: "…
Leonardo Herrera
  • 8,388
  • 5
  • 36
  • 66
0
votes
1 answer

Circe list deserialization with best-attempt and error reporting

I'm using Circe to deserialize json containing a list. Sometimes a few items in the json list are corrupted, and that causes the entire deserialization to fail. Instead, I want Circe to make a best attempt, and to return a list of all the…
thund
  • 1,842
  • 2
  • 21
  • 31
0
votes
1 answer

parsing a unstructured JSON timeseries with Argonaut

a webservice returns unstructured JSON that looks like this:- { "2018-04-09": { "1. open": "91.0400", "2. high": "93.1700", "3. low": "90.6200", "4. close": "90.7700", "5. volume":…
Karl
  • 1,164
  • 9
  • 25
0
votes
1 answer

DecodeJson not working after scalaz version update in application

I tried to upgrade the scalaz version to 7.2.18. In prior version following block of code was working quite well. implicit val decode: DecodeJson[Uuid] = DecodeJson( cursor => cursor.as[String].flatMap( str => DecodeResult( …
Sujit Baniya
  • 895
  • 9
  • 27
0
votes
1 answer

Writing DecodeJson for Sealed Trait Hierarchy?

Given: import argonaut._ import Argonaut._ import ArgonautShapeless._ sealed trait Parent case class Foo(x: Int) extends Parent case class Bar(y: String) extends Parent I attempted to define DecodeJson[Parent]: implicit val parentDecodeJson:…
Kevin Meredith
  • 41,036
  • 63
  • 209
  • 384
0
votes
1 answer

Errors when sending data in body using Finagle/Finch in Scala

I am using Finagle/Finch and I get this error: diverging implicit expansion for type argonaut.DecodeJson[A] starting with method MapDecodeJson in trait DecodeJsons diverging implicit expansion for type argonaut.DecodeJson[V] starting with…
James Black
  • 41,583
  • 10
  • 86
  • 166
0
votes
1 answer

Parsing subdocuments in Argonaut

I'm trying to parse following Json with Argonaut scala…
user3292534
0
votes
2 answers

Marshal akka `HttpResponse` as Argonaut `Json`

I'm trying to marshal an akka HttpResponse as such: { "code": 200, "headers": [], "body": "{\"data\": \"Yes!\"}" } If I write an Argonaut EncodeJson for this Instance, it might look like this: implicit def httpResponseEncodeJson:…
0
votes
0 answers

How to encode Scala case class with more than 22 fields to JSON using Argonaut?

I have a case class that has more than 22 fields in it. Let's say it looks like this (Scala pseudo code): case class X(A1: Int, A2: Int, ..., A22: Int, A23: Int, ..., A40: Int) Currently I can see only jencode function up to 22 fields so jencode22L…
flojdek
  • 155
  • 1
  • 8