Kris Wong

    Kris Wong

    2 years ago
    it seems most json APIs expect the type to be known in order to read the value
    p

    Patrick Jackson

    2 years ago
    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?
    Kris Wong

    Kris Wong

    2 years ago
    no, but it can have nested arrays
    i saw JsonElement and it's subclasses. seems it uses a string representation internally
    hmm, I might be able to make this work
    got this working, thanks for the idea
    p

    Patrick Jackson

    2 years ago
    Great!
    j

    jimn

    2 years ago
    protip: deserialize a Map