我有一个Java中的Map<String,String>
,就像这样:
{card_switch=Master, issuing_bank=ICCI, card_Type=DebitCard}
我正在使用简单的JSON解析器将此映射解析为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格式?