it seems most json APIs expect the type to be known in order to read the value
p
Patrick Jackson
12/10/2019, 4:27 PM
Have not done exactly this, but you may be able to do what you need by decoding to a JsonObject. This will give you a Map<String, JsonElement> . Unfortunately there is not an easy way to get the type, but you may be able to use JsonElement.primitive.booleanOrNull , floatOrNull, etc to find the type.
will your payload have nested objects?
k
Kris Wong
12/10/2019, 4:31 PM
no, but it can have nested arrays
Kris Wong
12/10/2019, 4:32 PM
i saw JsonElement and it's subclasses. seems it uses a string representation internally