我有Map<String,String>
在Java这样的:转换地图<字符串,字符串>为JSON
{card_switch=Master, issuing_bank=ICCI, card_Type=DebitCard}
我使用simple json parser解析这个地图分成JSON对象。
我想:
Object json = JSONValue.parse(entry.getKey());
但我得到一个错误信息:
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)
那是可能Map<String,String>
转换成JSON?
有你累GSON http://code.google.com/p/google-gson/ – Abubakkar
此网页上有一看例子1.4:HTTP://代码.google.com/p/json-simple/wiki/EncodingExamples#Example_1-4 _-_ Encode_a_JSON_object _-_ Using_Map_and_streaming –