mam Map<String,String>
w java tak:Konwersja Map <String, String> w json
{card_switch=Master, issuing_bank=ICCI, card_Type=DebitCard}
Używam simple json parser przeanalizować tę mapę do obiektu JSON.
Próbowałem:
Object json = JSONValue.parse(entry.getKey());
Ale pojawia się komunikat o błędzie:
Object json = JSONValue.parse(entry.getKey());
^
method JSONValue.parse(String) is not applicable
(actual argument Map<String,String> cannot be converted to String by method invocation conversion)
method JSONValue.parse(Reader) is not applicable
(actual argument Map<String,String> cannot be converted to Reader by method invocation conversion)
to możliwe do konwersji Map<String,String>
do JSON?
masz zmęczony GSON http://code.google.com/p/google-gson/ – Abubakkar
Wystarczy popatrzeć na przykład 1.4 na tej stronie: http: // code .google.com/p/json-simple/wiki/EncodingExamples # Example_1-4 _-_ Encode_a_JSON_object _-_ Using_Map_and_streaming –