我想基于 html 元素创建这个 JSON
{
"AppName": "ERP",
"ModuleDesc": [
{
"Name": "Payroll",
"AcCESSRIGHTS": [
{
"Create": "Y",
"Retrive": "Y",
"Update": "Y",
"Delete": "Y"
}
]
},
{
"Name": "Reports",
"AcCESSRIGHTS": [
{
"Create": "Y",
"Retrive": "N",
"Update": "Y",
"Delete": "N"
}
]
},
{
"Name": "Forms",
"AcCESSRIGHTS": [
{
"Create": "Y",
"Retrive": "Y",
"Update": "N",
"Delete": "N"
}
]
}
]
}
我的 HTML 是 :=
<table>
<tr>
<td style="width: 200px;">APPLICATION CATEGORY :</td>
<td>
<input id="Text1" maxlength="35" name="ONEICAPP" style="width: 400px; text-transform: uppercase"
type="text" value="INTERIOR SYSTEM" />
</td>
</tr>
</table>
<table>
<tr>
<td style="width: 400px;"> MODULE DESCRIPTION</td>
<td style="width: 50px;"> CREATE</td>
<td style="width: 50px;"> RETRIVE</td>
<td style="width: 50px;"> UPDATE</td>
<td style="width: 50px;"> DELETE</td>
</tr>
</table>
<div id="ModuleDescriptions">
<table >
<tr>
<td style="width: 400px;">
<input id="ModuleName1" maxlength="35" style="width: 400px; text-transform: uppercase" type="text" value="ALL REPORTS" />
</td><td>
<table ><tr>
<td style="width: 50px;"><input id="CRT-1" type="checkbox" name="ModuleName1" value="C" />
</td>
<td style="width: 50px;"><input id="RTV-1" type="checkbox" name="ModuleName1" value="R"/>
</td>
<td style="width: 50px;"><input id="UPD-1" type="checkbox" name="ModuleName1" value="U" />
</td>
<td style="width: 50px;"><input id="DLT-1" type="checkbox" name="ModuleName1" value="D" />
</td></tr></table></td>
</tr>
<tr>
<td style="width: 400px;">
<input id="ModuleName2" maxlength="35" style="width: 400px; text-transform: uppercase" type="text" value="CREATE MASTER" />
</td><td><table><tr><td style="width: 50px;"><input id="CRT-2" class="Rights" type="checkbox" name="ModuleName2" value="C" />
</td>
<td style="width: 50px;"><input id="RTV-2" class="Rights" type="checkbox" name="ModuleName2" value="R"/>
</td>
<td style="width: 50px;"><input id="UPD-2" class="Rights" type="checkbox" name="ModuleName2" value="U" />
</td>
<td style="width: 50px;"><input id="DLT-2" class="Rights" type="checkbox" name="ModuleName2" value="D" />
</td> </tr></table></td>
</tr>
<tr>
<td style="width: 400px;">
<input id="ModuleName3" maxlength="35" style="width: 400px; text-transform: uppercase" type="text" value="PROCESS" />
</td><td><table><tr><td style="width: 50px;"><input id="CRT-3" class="Rights" type="checkbox" name="ModuleName3" value="C" />
</td>
<td style="width: 50px;"><input id="RTV-3" class="Rights" type="checkbox" name="ModuleName3" value="R"/>
</td>
<td style="width: 50px;"><input id="UPD-3" class="Rights" type="checkbox" name="ModuleName3" value="U" />
</td>
<td style="width: 50px;"><input id="DLT-3" class="Rights" type="checkbox" name="ModuleName3" value="D" />
</td>
</tr></table></td>
</tr>
</table>
输入 ID 和相应的访问权限(复选框)名称相同我可以使用 Jquery .each 循环和动态构建 json 字符串吗?或任何其他方式..请帮助我