Klaxon is a library to parse JSON in Kotlin.
Questions tagged [klaxon]
42 questions
0
votes
1 answer
Serialize JSON with Klaxon
I'm trying to develop a system which alows serializing/deserializing of JSON for multiple types of classes in Kotlin. For deserialization I'm usung klaxon, but I also want to use it for serializstion. I've done some research on that, but didn't get…

broken_cursor
- 3
- 2
0
votes
0 answers
How to parse json file to be Array in object Class?
I got confused when Im try to parsing json in object class.
Im using klaxon but I just wonder how to read the file because I cannot use activity or application to add it into buffered object.
enter image description here

Hadisyah
- 34
- 4
0
votes
1 answer
Break if value exists in JSON, but if value is null then return (kotlin)
I am trying to learn kotlin, and I came across a library called klaxon for parsing JSON. If the value I get from input is null, I want the program to keep repeating itself. Otherwise if the key does exist that I have inputted, I want the program to…

dps910
- 3
- 1
0
votes
1 answer
Android Klaxon library: I can't handle a complex json response
I get a json response in android studio like this:
{
"status": "ok",
"data": {
idx:7397,
aqi:71,
time:{
v:1481396400,
s:"2016-12-10 19:00:00",
tz:"-06:00"
},
city:{
…

goku
- 1
0
votes
1 answer
How do I parse the json from thingspeak to get the field value using klaxon on android studio?
I'm using thingspeak and I have successfully got thingspeak to fetch the json data using okhttp but I don't know how to parse it correctly using klaxon.
Here is the code
private fun funButton1() {
println("Attempting to get JSON data!")
…
0
votes
1 answer
How to pass a reified parameter to some other function when current function can't be inline (but we have Reflections)?
Lets pretend we have an interface which defines the storage of data in some database by serializing them into json.
interface StorageApi {
suspend fun store(key: String, value: Any)
// inline suspend fun get(key: String): T…

Animesh Sahu
- 7,445
- 2
- 21
- 49
0
votes
1 answer
Parsing tiny JSON from android assets is incredibly slow
I am writing a simple Android app in Kotlin, which will show prayers divided into categories to user. There are 5 JSON files in assets folder, each of them has just around 10 KiB.
I use Klaxon for parsing the JSON files into those two data…

Firzen
- 1,909
- 9
- 28
- 42
0
votes
1 answer
Klaxon parse null enum
I am trying to parse a json response that include an enum using the Klaxon library and kotlin. Below is a test. If I have a nullable enum, my parsing fails. Is there a way to do this properly? Is it an issue with the Klaxon libary?
import…

Craig Smith
- 13
- 2
0
votes
1 answer
How I can get "error" or "success" from json in kotlin?
I try to make web android app in kotlin and everyday know something but about this error I didn't find solution. I work with OkHTTP3 and for Json I found Klaxon. How I can get from response "success" or "error" only.
For example: if I…

savera sleemy
- 73
- 1
- 12
0
votes
0 answers
Using Klaxon for JSON with Arrow for Option in Kotlin?
Koltin newbie here. If I have a library with (Kotlin) Borrowers and Books and a Book is checked out when it has a Borrower (using Arrow's Option datatype):
data class Borrower(val name: Name, val maxBooks: MaxBooks)
data class Book(val title: Title,…

ericky
- 1,641
- 2
- 14
- 16
0
votes
1 answer
Remove square bracket from println (Android/Klaxon)
Check this from the documentation of Klaxon. With toJsonString(true) I can remove the JsonArray(value=[...]. But the square brackets are still there. Is there another way to remove everything? I just want to print the value.
Before…

jamesxbrown
- 135
- 2
- 11
0
votes
1 answer
I cannot get the Klaxon dependency in Intellij to register
I for the life of me cannot seem to get the Klaxon dependency to work in Intellij. Other dependencies I have added (like gson) have worked fine. I have tried refreshing Gradle, tried a different version, etc. Nothing seems to be working so I can use…

scarpacci
- 8,957
- 16
- 79
- 144
0
votes
1 answer
Use Volley and Klaxon in non-activity class
I am trying to make a class representing a table in a database.
data class MSettings(
var name: String?,
var value: String?,
var Description: String?)
I need to get data from api. I'm trying use Volley, but Volley need context. I havent access to…

Michał B
- 96
- 10
0
votes
1 answer
How do I parse nested JSON using Klaxon and display in recyclerview?
This is my MainActivity.kt
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
var data = Klaxon()
…

Josephine N.
- 1
- 2
0
votes
0 answers
KotlinReflectionInternalError when compiling Klaxon and using Spring
I'm developing a web server with Kotlin and Spring and recently I decided to use Klaxon to format data for some logging. I'm using IntelliJ and the Kotlin plugin is updated to version 1.2.51.
I added compile 'com.beust:klaxon:3.0.1' to my Gradle…

Neo
- 3,534
- 2
- 20
- 32