微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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文档].

什么是任意数据?

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

jsfiddlehttp://jsfiddle.net/QPR4Z/2/

谢谢!

解决方法

arbitrary |ˈärbiˌtrerē|
adjective

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

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

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

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

原文地址:https://www.jb51.cc/js/158663.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐