Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Read resource file using Scala
/**
* I do this often enough to merit a Gist, but not often enough to remember by heart. Maybe someone else has the same problem.
* The ".mkstring" part can of course be altered to something else as needed, if you don't want a String
*/
import scala.io.Source
val jsonMsg: String = Source.fromURL(getClass.getResource("/json/test1.json")).mkString
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.