Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Hashmap で定義された nameValue ペアで構成される json オブジェクトを構築する
私が抱えている問題は、私が呼び出すときです:
jsonObject.put(hashmap);
次のように nameValue ペアを追加します。
name=valueそれ以外のname:value
name=value
name:value
何かご意見は?
ありがとう
HashMap を繰り返し処理し、jsonObject に入れます。
Iterator it = mp.entrySet().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry)it.next(); jsonObject.put(pairs.getKey(), pairs.getValue() ); }