I have Map<String,String> in java like this :
{card_switch=Master, issuing_bank=ICCI, card_Type=DebitCard}
I’m using the simple json parser to parse this map into json object.
I tried :
Object json = JSONValue.parse(entry.getKey());
But I get an error message :
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)
Is that possible to convert Map<String,String> into json?
Have a look at example 1.4 on this page http://code.google.com/p/json-simple/wiki/EncodingExamples#Example_1-4_-_Encode_a_JSON_object_-_Using_Map_and_streaming: