DEV Community

Discussion on: Handling unknown JSON structures

Collapse
 
alainvanhout profile image
Alain Van Hout

That's also possible with map-based parsing: it parses a JSON array to a List, mostly at whichever nested depth. You of course need to do type checking, but that's equally true for the the other approach, since calling getAsInt() on a string also inherently has its costs.

Thread Thread
 
sorincostea profile image
Sorin Costea

For my lazy use case returning null (or providing a default) instead of try/catching covered 100%. Anyway vert.x solution is just a thin layer over Jackson so it's not like they reinvented the wheel... just simple things made even simpler.