将JSON响应格式化为表时,其ArrayOfString

时间:2018-09-11 10:33:07

标签: jquery json

这是我收到的JSON响应:

<ArrayOfstring xmlns:i="protocol://www.w3.org/2001/XMLSchema-instance" xmlns="protocol://schemas.microsoft.com/2003/10/Serialization/Arrays">
<string>{</string>
<string> "PersonIdentifier" : "65535",</string>
<string> "Forename" : "Fred",</string>
<string> "Surname" : "Citroen",</string>
<string> "DateOfBirth" : "1987-05-18",</string>
<string> "GenderCode" : "M",</string>
<string> "Version" : "87871705",</string>
<string> "Table" : "PERSONS",</string>
<string> "Column" : "rowid",</string>
<string> "Value" : "AAAYChAAFAAACApAAN",</string>
<string> "CurrentDateTime" : "20180911 111101.693"</string>
<string>}</string>
</ArrayOfstring>

我需要将其格式化为预定义的表格,如下所示:

<table id="tableSK">
  <tr>
    <th>Forename</th>
    <th>Surname</th>
    <th>DateOfBirth</th>
    <th>Gender</th>
  </tr>
</table>

如果我在下面的JQuery中使用

 $('#tableSK').append('<tr/>');
                 $.each(response, function(i, field){
                $('#tableSK').find('tr:last').append('<td>' + field + '</td>');    
                });

我得到以下输出:

Click to see the output as an image

从本质上讲,我需要从输出中选择字符串,但要选择特定的命名属性,而不是所有内容。

有人可以指导我使用正确的JQuery吗?

0 个答案:

没有答案