如何从json构建html表?对于负值,我想将行加粗。并先显示NJ仓库,然后显示CA
{
"action": "query",
"Time": 12,
"data": [
{
"Product": "Iphone",
"Price": 989,
"Warehouse": "NJ"
},
{
"Product": "Ipad mini",
"Price": 429,
"Warehouse": "NJ"
},
{
"Product": "Iphone mini",
"Price": 489,
"Warehouse": "NJ"
},
{
"Product": "Galaxy",
"Price": -1,
"Warehouse": "CA"
},
{
"Product": "Galaxy mini",
"Price": "595.99",
"Warehouse": "CA"
}
]
}
结果应如下所示,首先显示所有Warehouse = US,然后显示Warehouse = CA
美国 产品价格仓库 Iphone 989.00美国 Ipad mini 429.00美元 Iphone mini 489.00美元 认证机构 产品价格仓库 **银河-1美国** Galaxy mini 595.99 CA
<table width="200" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="100" colspan="3">NJ</td>
</tr>
<tr>
<td width="100">Product</td>
<td width="50">Price</td>
<td width="50">Warehouse</td>
</tr>
<tr>
<td>Ipad mini</td>
<td>429.00</td>
</tr>
<tr>
<td>Iphone mini</td>
<td>429.00</td>
</tr>
<tr>
<td width="100" colspan="3">CA</td>
</tr>
<tr>
<td width="100">Product</td>
<td width="50">Price</td>
<td width="50">Warehouse</td>
</tr>
<tr>
<td>Galaxy</td>
<td><B>-1</B></td>
</tr>
<tr>
<td>Galaxy mini</td>
<td>595.99</td>
</tr>
</table>