通过Spring启动将JavaScript对象Post请求转换为JSON

通过Spring启动将JavaScript对象Post请求转换为JSON,javascript,json,spring-boot,rest,Javascript,Json,Spring Boot,Rest,我不熟悉编码,我正在使用Spring Boot的Crud存储库和POST请求保存单行数据,//但我想知道如何使用Spring Boot在单个POST请求中保存多行数据: 以下是我发送单行数据的过程: // Declaring Variable for MySQL Table Column for getting html data into JavaScript var data = { billNo : "", descripti

我不熟悉编码,我正在使用Spring Boot的Crud存储库和POST请求保存单行数据,//但我想知道如何使用Spring Boot在单个POST请求中保存多行数据:

以下是我发送单行数据的过程:

// Declaring  Variable for MySQL Table Column  for getting html data into JavaScript



 var data = {
           billNo : "",
     descriptions : "",
          account : "",
          amount  : 0,
    };

// Setting HTML Values into JavaScript
// I Used 'x' for multiple Rows for HTML document ID, 'x' is 0 for First Row, 1 for 2nd Row and go on.
            
data.billNo = document.getElementById("BillNo"+x).value;
data.descriptions = document.getElementById("Description"+x).value;
data.acount = document.getElementById("Account"+x).value;
data.amount = document.getElementById("Amount"+x).value;

// Converting JavaScript to JSON

var json = JSON.stringify(data);
    
//Sending POST Request : Every thing is OK if Single Row Data
HTTP('Post','/expenses',json).then(jsonData => {
      //Start of Request Object
        console.log(jsonData);
        //End of Request Object

});

//HTTP Request Function

const HTTP = (method, url,JSON)=>{
    const PROMISE = new Promise((resolve, reject) =>{
        const XHRR = new XMLHttpRequest();
        XHRR.open(method,url);
        XHRR.responseType="json";
        XHRR.setRequestHeader('Content-Type', 'application/json');
        XHRR.onload = () => {
            resolve(XHRR.response);
            };
        XHRR.send(JSON);
    });
    
    return PROMISE;
};
我可以使用HTML动态行和动态文档ID。图片附在我的HTML屏幕上

我想知道如何为多行保存数据