問題タブ [jettison]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - ネストされた HashMap を Jettison JSONObject に変換する方法
Map<String, Map<String, String>> を Codehaus-Jettison JSONObject に変換する必要があります。
Gson や他のライブラリを使用すると、これを実現する簡単な方法があることは承知していますが、この場合は Jettison を使用する必要があります。
ドキュメントから私が理解していることは、私ができることです:
しかし、new JSONObject(map)
Map<String, String> でのみ機能しているようで、上記のコードでは、次の誤った出力になります。
私の目的の出力は、次のような適切な JSON コンテンツである必要があります。
Jettisonのみでこれを行う方法はありますか?