Convert Hashmap Into Json

[Solved] Convert Hashmap Into Json | Java - Code Explorer | yomemimo.com
Question : Convert hashmap to json object

Answered by :

{"tags":[{"tag":"textarea","content":"import org.json.JSONObject;\n\n HashMap<Object, Object> map = new HashMap<>();\n String[] list={\"Grader\",\"Participant\"};\n String[] list1={\"Assistant\",\"intern\"};\n map.put(\"TeachingAssistant\",list);\n map.put(\"Writer\",list1);\n\tJSONObject jsonObject = new JSONObject(map);\n\tSystem.out.printf(jsonObject.toString());\n\nBurada map bir istekten d\u00f6nen sonucta olabilir.\no zaman \u015f\u00f6yle de kullanabilirsin : \nString jsonString = new JSONObject((Map<?, ?>) clients.postWithHeader(url, body, headers, Host.SERVICE)).toString();\n\n\n\n \/\/ Result: {\"TeachingAssistant\":[\"Grader\",\"Participant\"],\"Writer\":[\"Assistant\",\"intern\"]}","code_language":"javascript"}]}

Source : https://stackoverflow.com/questions/12155800/how-to-convert-hashmap-to-json-object-in-java | Last Update : Wed, 21 Jun 23

Answers related to convert hashmap into json

Code Explorer Popular Question For Java