How to convert a JSON string to a Map<String, String> with Jackson JSON

Posted by Infinity on Stack Overflow See other posts from Stack Overflow or by Infinity
Published on 2010-03-26T16:46:42Z Indexed on 2010/03/26 16:53 UTC
Read the original article Hit count: 680

Filed under:
|

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!

© Stack Overflow or respective owner

Related posts about java

Related posts about jackson