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.
これは私が持っているJSONの例です
filter : [ { category: [] } , { sub-category: [] } , { brand: [] } , { color: [] } ]
ラベル「カテゴリ、サブカテゴリ...」は動的に変化する可能性があることに注意してください
Moshi を使用してこの JSON を解析するにはどうすればよいですか?
としてデコードしMap<String, Object>ます。マップ キーは JSON の値になります。そのアダプターは次のように取得できます。
Map<String, Object>
Type map = Types.newParameterizedType(Map.class, String.class, Object.class); JsonAdapter<Map<String, Object>> adapter = moshi.adapter(map);