-
-
Save ejektaflex/66b2cd09be90bfb1977a293580f411d3 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
buildscript { | |
ext.kotlin_version = '1.2.10' | |
dependencies { | |
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | |
} | |
} | |
apply plugin: 'java' | |
apply plugin: 'kotlin' | |
sourceCompatibility = 1.8 | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" | |
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" | |
// Errors on Klaxon 2.0.3 as well | |
compile 'com.beust:klaxon:2.0.5' | |
} |
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
import com.beust.klaxon.Klaxon | |
import data.StockEntry | |
import java.io.File | |
fun main(args: Array<String>) { | |
val stockFile = File("src/main/kotlin/data/STOCK.json").inputStream() | |
val data = Klaxon().parseArray<StockEntry>(stockFile) | |
println(data) | |
} |
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
package data | |
data class StockEntry( | |
val date: String, | |
val close: Double, | |
val volume: Int, | |
val open: Double, | |
val high: Double, | |
val low: Double | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment