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
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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?