【发布时间】:2014-06-03 19:33:01
【问题描述】:
这个问题最初的标题是:How to remove -xmlnl tags when I receive JSON from a XML-HTTP-API server?,但现在我明白了问题的概念。
这个问题是关于Android 中关于JSON 翻译的一个例外。我向c# 和一些api 发出的HTTP GET 请求(不是我的)webserver,当我从浏览器调用它时,答案出现在XML 中,当我从我的Android 应用程序调用它,结果在JSON。
问题是我收到一个 JSON 错误,例如:Value {"-xmlnl:d4p1":"http://schemas..."} of Alternativas of type org.json.JSONObject cannot be converted to JSONArray
XML 中的代码拥有这样的内容之王:
<Alternativas xmlns:d4p1="http://schemas.datacontract.org/2004/07/PainelMonitor.Model"/>
<Descricao>A primeira fraze que você ouviu hoje foi?</Descricao>
我只对<Descricao> 内容感兴趣。
这个{"-xmlnl:d4p1":"http://schemas..."} 不应该出现在 JSON 中,它让我的应用崩溃了。
那么我怎样才能从我的 JSON 中去掉它呢?代码中有“数十个”这些无效标记,所以我不能手动执行,因为它是 JSON 的Array。
【问题讨论】:
-
我试过 apache camel 但无法使用。