jconfig
JConfig is a simple library made to help with storing and retrieving data from a json file.
Supporting both Kotlin and Java.
Example
For example, say you are making a discord bot and you want to store the token in a json file, you can do this:
create a config.json file in the root of your project. If you want you can change the files name, but I will shows you how to do it with the default name.
{
"token": "YOUR_TOKEN_HERE"
}
Content copied to clipboard
We know need to get the token, so we will use JConfigUtils which has a standard builder.
val token = JConfig.build()
.get("token")
.asText()
Content copied to clipboard
And thats it for getting the token.
Installation
Maven
<dependency>
<groupId>io.github.realyusufismail</groupId>
<artifactId>jconfig</artifactId>
<version>1.1.1</version>
</dependency>
Content copied to clipboard
Gradle
//kotlin
dependencies {
implementation("io.github.realyusufismail:jconfig:1.1.1")
}
//groovy
dependencies {
implementation "io.github.realyusufismail:jconfig:1.1.1"
}
Content copied to clipboard