I'm parsing JSON strings sent from my WLAN speakers using Java/Jackson, whose format is unfortunately varying. While there's some static and not so important part of the response which is quite easy to parse, the really essential stuff may have many different structures, depending on the command sent to the speaker.
For that purpose, I think jackson's TypeReference() is best to map the current structure to key/value pairs and then see what we have. Problem is that I don't really understand how TypeReference works, and I don't want to blindly use "magic" functions where I have no clue what's actually happening. The reference states that sub classing is used, but the following syntax is not really clear to me, especially and foremost the empty curly brackets at the end:
TypeReference ref = new TypeReference<List<Integer>>() { };
Can someone explain to me how this class works? Many thanks in advance!
> extends TypeReference {} ? Sorry for my stupid questions, I just don't get the whole thing yet. Maybe I'm just too retarded or inexperienced :-(
– Oidipous_REXX Jun 20 '18 at 11:59