I wanted to read an entire json file which contains my test request. I found this very quick and super simple 1 line to read an entire file as string.

Quickest Solution

File("path/my-test.json").readText()

Some other alternatives to read file

Read all lines as ArrayList<String>

val lines = Files.readAllLines( encoding)
println(lines)

Reading as bytes

val encoded = Files.readAllBytes(Paths.get("my-test.json"))
val asText = String(encoded, encoding)