javascript – 什么是任意数据/ JSON?

前端之家收集整理的这篇文章主要介绍了javascript – 什么是任意数据/ JSON?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我最近遇到了任意数据/任意json一词,我似乎无法理解究竟是什么和/或找到任何文件.我知道 JSON是一种通过互联网发送数据的格式,那么格式究竟是如何随意的呢?

编辑::

//更多代码

var buildItem = function(item) {
    var title = item.name,args = [],output = '<li>';

    if (item.type == 'method' || !item.type) {
      if (item.signatures[0].params) {
        $.each(item.signatures[0].params,function(index,val) {
          args.push(val.name);
        });
      }
      title = (/^jQuery|deferred/).test(title) ? title : '.' + title;
      title += '(' + args.join(',') + ')';
    } else if (item.type == 'selector') {
      title += ' selector';
    }
    output += '<h3><a href="' + item.url + '">' + title + '</a></h3>';
    output += '<div>' + item.desc + '</div>';
    output += '</li>';

    return output;
  };

//more code

在上面的示例代码中,我被告知.params是来自JSON请求的任意数据[用于jQuery API文档].

什么是任意数据?

非常感谢任何答案和/或澄清.

jsFiddle:http://jsfiddle.net/QPR4Z/2/

谢谢!

解决方法

arbitrary |ˈärbiˌtrerē|@H_403_26@ adjective

based on random choice or personal whim,rather than any reason or@H_403_26@ system: his mealtimes were entirely arbitrary.

  • Mathematics: (of a constant or other quantity) of unspecified value.

这只意味着那里可能有任何价值.这与一个说“像这个数组总是包含X,Y和Z”的规范相反.相反的任意值说“我们在这个阵列中发送了一些东西,但我们不能事先告诉你究竟是什么.”如果你被告知你可以自己发送任意数据,这意味着你可以发送任何你想要的东西,它不必遵循任何特定的格式.

请注意,这完全是关于JSON格式中包含的数据,而不是JSON格式本身.

原文链接:https://www.f2er.com/js/158663.html

猜你在找的JavaScript相关文章