How to convert a JSON string to a Map<String, String> with Jackson JSON
- by Infinity
This is my first time trying to do something useful with Java..
I'm trying to do something like this but it doesn't work:
Map<String, String> propertyMap = new HashMap<String, String>();
propertyMap = JacksonUtils.fromJSON(properties, Map.class);
But the IDE says: 'Unchecked assignment Map to Map<String,String>'
What's the right way to do this?
I'm only using Jackson because that's what is already available in the project, is there a native Java way of converting to/from JSON?
In PHP I would simply json_decode($str) and I'd get back an array. I need basically the same thing here.
Thanks!