Controlling the type of data returned by JSONPath's read() method

120 views
Skip to first unread message

Adam Bolding-Jones

unread,
Dec 1, 2016, 2:50:37 PM12/1/16
to JsonPath
I've tried asking this question on SO with no success so I thought I'd try here. The full question is at the link below, but the gist is "is there a way I can force JSONPath to always return strings"? Right now it's returning whatever it deems most appropriate -- even if I do something like ArrayList<String> JsonPath.read(...) JSONPath will squeeze non-strings into my ArrayList. The only workaround I've found so far is to use an ArrayList of Objects and use the instanceof keyword to figure out what I can cast each element to, but that solution is pretty awful. What am I missing here?

Here's the full question ON SO :
https://stackoverflow.com/questions/40748442/controlling-the-type-of-data-returned-by-jsonpaths-read-method
Reply all
Reply to author
Forward
0 new messages