Open lwronski opened 5 years ago
Hi, @martmarch!
It shouldn't be too hard to add a module with such kind of marshaller/unmarshaller based on jsoniter-scala.
Here are a couple of examples of jsoniter-scala-core usage for different ASTs:
Both are not ideal and don't provide BigInt
/BigDecimal
support (but it can be added using a pre-scanning trick like this). Or just open an issue in this repo for adding parsing method like in.readNumber(): Long | Double | BigInt | BigDecimal
and I will start to think how it can be done in a most handy, precise, safe and efficient way.
Parsing of big numbers from JSON input as strings and then transforming them using standard Scala/Java parsers is unsafe. See about consequences here or here.
The best option when application can provide some metadata to guide which numeric type should be parsed at given place of JSON.
Another part of the implementation that should be made with care is working with hash maps and sets (including toMap/toSeq/groupBy/distinct
calls for sequences where they are used internally). More details about related vulnerabilities see here
Hi I would like to build bridge for Jsoniter and Sangria. I thought, it would be written similar to what was done for Circe https://github.com/sangria-graphql/sangria-circe/blob/master/src/main/scala/sangria/marshalling/circe.scala
Could you like give me some tips how to do this ?
Thanks in advance for help