Nathan February 2016

Seralizing a scala object into a JSON at compile time

I'm looking for way to serialize a defined object into a JSON and place it in the resources directory at compile-time. What's the cleanest way to do this?

Answers


dth February 2016

SBT can do stuff like that:

http://www.scala-sbt.org/0.13/docs/Howto-Generating-Files.html

A macro would be an alternative, but setting sbt up to compile macros in two stages, is probably more difficult. Also, this only makes sense if calling such a macro should be part of your application code.

Post Status

Asked in February 2016
Viewed 1,182 times
Voted 12
Answered 1 times

Search




Leave an answer