我正在努力估計我們將在PhoneGap
(用於Hybrid Dev)或Xcode
/Eclipse
(用於Native Dev)中構建的應用程序的編碼工作量, 。現在,我在哪裏卡住了部分...
我打一個Web API (現在使用REST-Client
,在代碼最終實施前)並獲得成功擊中後如下回應:如何將Web API的響應從HTML標記格式轉換爲JSON
<!DOCTYPE html>
<html>
<head>
<title>Thing : DataTable Service Definition: getNumber</title>
</head>
<body>
<br>
`
<link href='/abc/css/xyz.css' rel='Stylesheet' type='text/css'>
<meta content='text/html' http-equiv='Content-Type'>
<meta content='no-cache, no-store' http-equiv='cache-control'>
<meta content='-1' http-equiv='expires'>
<meta content='no-cache, no-store' http-equiv='pragma'><img src=
"/abc/images/xyzLogo.png"><br>
<h1>Thing : DataTable Service Definition: getNumber</h1>
<table>
<tr>
<th>description</th>
<th>name</th>
<th>parameterDefinitions</th>
<th>resultType</th>
</tr>
<tr>
<td></td>
<td>getNumber</td>
<td>
<table>
<tr>
<th>baseType</th>
<th>description</th>
<th>name</th>
<th>bishop</th>
</tr>
<tr>
<td>STRING</td>
<td></td>
<td>param1</td>
<td>1.0</td>
</tr>
<tr>
<td>STRING</td>
<td></td>
<td>param2</td>
<td>2.0</td>
</tr>
<tr>
<td>DATETIME</td>
<td></td>
<td>param3</td>
<td>3.0</td>
</tr>
<tr>
<td>DATETIME</td>
<td></td>
<td>param4</td>
<td>4.0</td>
</tr>
</table>
</td>
<td>
<table>
<tr>
<th>baseType</th>
<th>description</th>
<th>name</th>
<th>bishop</th>
</tr>
<tr>
<td>INFOTABLE</td>
<td></td>
<td>result</td>
<td>0.0</td>
</tr>
</table>
</td>
</tr>
</table>`<br>
<br>
...
</body>
</html>
由於我熟悉JSON序列化/解析,我正在尋找一種方法來將此API響應從HTML
標記格式轉換爲JSON
格式。
我覺得我只是一個或兩個線遠離我需要什麼,但後來,不知道我缺少什麼或不知道的...
等待一個快速的解決方案,請!
[Map HTML to JSON]可能的重複(http://stackoverflow.com/questions/12980648/map-html-to-json) – 2015-03-02 11:08:37
不完全@MerianosNikos,因爲它基本上看起來像一個大的長切到附近的解決方案。 其中之一,我正在尋找(現在)的方式來轉換REST客戶端瀏覽器插件上的此響應。其次,尋找像可能爲我做的參數的變化/用法。就像,_例如,_他們已經在您建議的_possible duplicate_的理論部分中編寫了'text \ xml'。 – 2015-03-02 11:16:31