Convert JSON to Map

后端 未结 17 2865
天涯浪人
天涯浪人 2020-11-22 10:20

What is the best way to convert a JSON code as this:

{ 
    \"data\" : 
    { 
        \"field1\" : \"value1\", 
        \"field2\" : \"value2\"
    }
}
         


        
17条回答
  •  无人及你
    2020-11-22 10:56

    One more alternative is json-simple which can be found in Maven Central:

    (JSONObject)JSONValue.parse(someString); //JSONObject is actually a Map.
    

    The artifact is 24kbytes, doesn't have other runtime dependencies.

提交回复
热议问题