-1

我正在尝试将 JSON 数据写入数据库。如何将每一列发送到数据库中的相应列。我试图将数据放入

var data = JSON.parse(data)

那没有用。变量数据仅显示以下格式的信息:

[object Object],[object Object],[object Object],[object Object],[object Object]

我的实际数据格式如下。编写以下代码后,我得到以下数据。如何将这些数据保存在数据库中?

// 生成以下输出的代码。

   $(document).ready(function () {
 $("#check").click(function(){

 var rows = $('#jqxgrid').jqxGrid('getrows');

 var rowData = JSON.stringify(rows);

$.post("GridValues.jsp", {"rowValues": rowData });

 });
    }); 

//如果打印rowData低于则输出

[{"empId":"1","fname":"Henry","lname":"Rey","empcat":"Staff","dept":"IT","jTitle":"Software Engg","rAccess":"New Hire","lManager":"Admin","sDate":"2012-10-11","eDate":"2012-10-11","uid":0},{"empId":"2","fname":"Nick","lname":"Murry","empcat":"Staff","dept":"IT","jTitle":"Administrator","rAccess":"New Hire","lManager":"Admin","sDate":"2012-10-11","eDate":"2012-10-11","uid":1},{"empId":"3","fname":"John","lname":"Danilo","empcat":"Staff","dept":"IT","jTitle":"Administrator","rAccess":"New Hire","lManager":"Admin","sDate":"2012-10-11","eDate":"2012-10-11","uid":2},{"empId":"4","fname":"Joene","lname":"Anson","empcat":"Staff","dept":"IT","jTitle":"Software Engg","rAccess":"New Hire","lManager":"Admin","sDate":"2012-10-11","eDate":"2012-10-11","uid":3}]
4

1 回答 1

0

我不能说我完全理解您的问题,这是一个有用的 SO 答案,可能会对您有所帮助。您可能还想查看Jackson JSON

于 2012-10-16T04:41:13.970 回答