androidjsonklaxon

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 toJsonString(true):

JsonArray(value=[ValueOfJSON])

After toJsonString(true):

["ValueOfJSON"]

That's what I want:

"ValueOfJSON"

Solution

  • A simple hackaround is:

    your_string_name.split('"')[1]