json嵌套json_json的tech101

json嵌套json

While Voorhees, Statham, and Derulo all have their talents, both good and evil, I would propose that the best Json goes to the machine-readable file format. Json, or rather JSON, is an important acronym in the tech world. JSON stands for JavaScript Object Notation. It is frequently used by data professionals, software engineers, and folks in IT. If you have never written a piece of code, this will seem like a foreign language to you. Guess what? It is.

尽管Voorhees,Statham和Derulo都有自己的才能,无论善与恶,但我还是建议最好的Json使用机器可读的文件格式。 Json,或者说JSON,是科技界的重要首字母缩写。 JSON代表JavaScript对象符号。 数据专业人员,软件工程师和IT人员经常使用它。 如果您从未编写过一段代码,那么对于您来说,这似乎是一种外语。 你猜怎么了? 它是。

Let’s break it down.

让我们分解一下。

{JS:JavaScript} ({ JS: JavaScript })

JavaScript is a scripting or programming language that allows you to implement complex features on web pages (per Mozilla). This is one of the most popular programming languages used for constructing websites. Whether you are visiting Zillow.com or Gap.com , or almost any website, it is highly likely that the construction relies, to some extent, on JavaScript. How do I know that they use JavaScript?

JavaScript是一种脚本或编程语言 ,可让您在网页上(按Mozilla )实现复杂的功能。 这是用于构建网站的最流行的编程语言之一。 无论您访问的是Zillow.com还是Gap.com或几乎任何网站,该构造在某种程度上都依赖JavaScript。 我怎么知道他们使用JavaScript?

Let’s take a look.

让我们来看看。

  1. Open up a new tab and go to Gap.com (see images below).

    打开一个新标签,然后转到Gap.com (请参见下图)。

  2. Right click anywhere on the page and select, “Inspect Element” or “Inspect”, depending on your browser. This will open a new panel in the window from the bottom half.

    右键单击页面上的任意位置,然后根据您的浏览器选择“检查元素”或“检查”。 这将在下半部分的窗口中打开一个新面板。
  3. In this new panel, confirm that you are on the “Elements” or “Inspector” tab. Scroll up or down until you see the word, “text/javascript” or a file name that ends in “.js”.

    在此新面板中,确认您位于“元素”或“检查器”选项卡上。 向上或向下滚动,直到看到单词“ text / javascript”或以“ .js”结尾的文件名。
Image for post
Image for post
Go to Gap.com. Right click and select “Inspect” or “Inspect Element”.
转到Gap.com。 右键单击并选择“检查”或“检查元素”。
Image for post
Image for post
Under the “Elements” or “Inspector” tab, you can look for mentions of “javascript” or “.js” files.
在“元素”或“检查器”选项卡下,您可以查找对“ javascript”或“ .js”文件的提及。

One example of code is a line that reads the following:

代码示例之一是一行读取以下内容的代码:

<script type=”text/javascript” src=”/static_content/onesitecategory/components/mfe/sitewide-app/69.5e08e990.js? defer=”defer”.></script>

The above line calls one specific JavaScript file to run a set of code, or instructions. The instructions (i.e. JavaScript) change how the Gap homepage looks and feels when you interact with it.

上一行调用一个特定JavaScript文件来运行一组代码或指令。 这些说明(即JavaScript)更改了与Gap主页交互时的外观。

{ON:对象符号} ({ ON: Object Notation })

Merriam-Webster defines notation as a system of characters, symbols, or abbreviated expressions used in an art or science or in mathematics or logic to express technical facts or quantities. One common notation is using $x$ to represent an unknown value, or variable, in mathematics. However, in this instance, humans designed JSON as a specific notation that can be easily interpreted by a machine. An apt comparison for notation that is easily human-readable would be a grocery list. The graphic below shows the transition of a typical grocery list from normal human notation into a JSON format.

Merriam-Webster将符号定义为在艺术或科学,数学或逻辑中用于表达技术事实或数量的字符,符号或缩写表达形式的系统。 一种常见的表示法是使用$ x $表示数学中的未知值或变量。 但是,在这种情况下,人们将JSON设计为一种特定的符号,可以由机器轻松解释。 一个易于理解的符号比较是一个购物清单。 下图显示了典型的杂货清单从普通的人类符号到JSON格式的过渡。

Image for post

In this graphic, the objects are the name of the list, the categories of grocery items, and the various items themselves. Each object is surrounded by curly brackets, while the items inside them are written as “key” : “value” pairs. You can try writing in a JSON format here.

在此图形中,对象是列表的名称,杂货项目的类别以及各种项目本身。 每个对象都用大括号括起来,而其中的项目则写为“键”:“值”对。 您可以在此处尝试以JSON格式编写。

{如何解释JSON? } ({ How Can I Interpret JSON? })

Because JSON files are difficult for humans to interpret, programmers need to eventually convert the output into something more readable. If you don’t have any programming knowledge and need to interpret a JSON file, there are JSON viewers on the web. We can test one out with the grocery list in JSON format from the image above.

由于JSON文件难以让人理解,因此程序员需要最终将输出转换为更具可读性的内容。 如果您没有任何编程知识,并且需要解释JSON文件,那么网络上就有JSON查看器。 我们可以从上图使用JSON格式的杂货店清单进行测试。

  1. Open a new tab for this JSON viewer (see images below).

    为此JSON 查看器打开一个新标签(请参见下图)。

  2. While in the “Text” tab, paste in the JSON code below:

    在“文本”标签中,粘贴以下JSON代码:

    {“Grocery List”: {“Food”: { “Bread”: “1 loaf”, “Chips”: “2 bags” }, “Drinks”: {“Soda”: “2 12 packs”, “Water”: “1 case”}, “Other”: {“Paper Towels”: “4 rolls”, “Cups”: “30 plastic cups”}}}

    {“杂货清单”:{“食物”:{“面包”:“ 1条面包”,“薯片”:“ 2袋”},“饮料”:{“苏打水”:“ 2 12包”,“水”: “ 1个案例”},“其他”:{“毛巾纸”:“ 4卷”,“杯子”:“ 30个塑料杯”}}}

  3. Click the “Viewer” tab

    点击“查看器”标签
  4. Click the plus signs to keep opening up the different objects.

    单击加号以继续打开不同的对象。
Image for post
Paste in the JSON string from above.
从上方粘贴JSON字符串。
Image for post
In the Viewer tab, click the plus signs to open up the objects.
在“查看器”选项卡中,单击加号以打开对象。

{为什么JSON重要? } ({ Why is JSON Important? })

Imagine trying to read a Harry Potter novel written in JSON format. Reading an entire chapter would probably take hours and it would give you a headache. This is comparable to the struggle that machines have with reading and interpreting our novels written in paragraph form, except I don’t think computers can have headaches. Regardless, a machine can read a JSON formatted file MUCH FASTER than data or text written in a human-readable format. Programmers refer to speed as performance. Programmers love it when their code has high performance (i.e. executes quickly).

想象一下,尝试阅读用JSON格式编写的哈利波特小说。 阅读整章可能要花费几个小时,这会让您头疼。 这与机器在阅读和解释以段落形式写成的小说时所进行的斗争相当,但我认为计算机不会让人头疼。 无论如何,与以人类可读格式写入的数据或文本相比,机器读取JSON格式的文件都要快得多。 程序员将速度称为性能。 当程序员的代码具有高性能(即快速执行)时,程序员会喜欢它。

Image for post
Unsplash Unsplash

Next time you hear someone mention JSON, it will no longer seem like a foreign language to you. No need to bite your pencil out of frustration. Think back to your grocery list. All JSON does is transform information into a different format. The new format allows machines to read the information quicker. I’m sure you will perform well, too.

下次您听到有人提到JSON时,对您而言,它将不再像外国语言。 无需因挫折而咬铅笔。 回想一下您的购物清单。 JSON所做的只是将信息转换为其他格式。 新格式使机器可以更快地读取信息。 我相信您也会表现出色。

~ The Data Generalist

数据通才

翻译自: https://towardsdatascience.com/tech101-who-is-json-ab670914a9bb

json嵌套json

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值