循环遍历sql server中从ajax发送的数据

循环遍历sql server中从ajax发送的数据,sql,sql-server,ajax,angularjs,Sql,Sql Server,Ajax,Angularjs,正在发送的样本数据: { "Demo":"A 25-54", "Headlines": { "0":"Headline one", "1":"Headline two" } } 后请求: $http({ method : 'POST', url : 'api/endpoint', data : $.param( availForm.formData ), headers : { 'Content

正在发送的样本数据:

 {
   "Demo":"A 25-54",
   "Headlines":
   {
     "0":"Headline one",
     "1":"Headline two"
   }
 }
后请求:

  $http({
    method  : 'POST',
    url     : 'api/endpoint',
    data    : $.param( availForm.formData ),
    headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
    }).success(function(data) { alert('done'); }).
如何将数据呈现给SQL:

我能够得到发布的“Demo”很好,因为它不是嵌套的,但是我如何通过SQL插入第二个标题呢


注意:我使用的是SQL SERVER。

我结束时只使用了这个正则表达式来删除编码后的百分比请求,并在服务器上生成可用的变量

String.prototype.trimAndCompact = function() {
return this
    // Remove whitespace start/finish
    .replace(/(^\s+)|(\s+$)/g, '')
    // Replace any double spaces with only one space
    .replace(/\s+/g, ' ')
    // Remove %5D and %5B relevant to the percent encoding
    .replace(/%5B/g,'').replace(/%5D/g,'');
};
//请注意添加的trimandcomact()


您可能希望展示一些您尝试过的代码,以及哪些代码有效,哪些代码无效。如果您希望获得一些良好的反馈,您通常希望避免sql中的循环和字符串解析。有几种json解析器可用于多种平台,我会尝试从json数据中获取数据表结构,并将其作为表类型参数发送给sql server。@Zoharpeld感谢您的输入。
$http({
    method  : 'POST',
    url     : 'api/endpoint',
    data    : $.param( availForm.formData ).trimAndCompact(),
    headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
    }).success(function(data) { alert('done'); });