Last active
June 8, 2019 23:20
-
-
Save d108/4f2b517308d504c85c085ceb14b63eea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val data1 = Klaxon().parse<String>(File(pathname).toString()) | |
// This just tried to parse the filename. | |
val data2 = Klaxon().parse<File>(StringReader(File(pathname).toString()) | |
// What's a Reader? I think that's what I need. | |
val data3 = Klaxon().parse<String>(File(pathname).readText()) | |
// Oh, there's a readText(). Why didn't this work? It seems it's the wrong parse call evenough the types match. | |
val data4 = Klaxon().parseJsonObject(StringReader(File(pathname).readText())) | |
// There we go. I get two keys as a result. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment