简体   繁体   中英

JAVA: json string to Map<string, string> (or an object)

I'm looking for a simple json library to convert json-string to Map or a POJO object. I know it's a duplicate, still I got specific requirements:

  1. no weird dependencies like json-lib (why do you need all of them for a simple task?)
  2. use few lines of codes to accomplish it (KISS principle).
  3. I prefer conversion to Map but POJO will be good almost as well.

that's it.
what do you suggest?

Jackson is good, but I think you can also give GSON a try. It's simple and easy to use. And there is a unit test for converting json string to Map and vice versa. Check this: MapTest.java

Hope this help you.

在这种情况下, 杰克逊将是最好的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM