An Introduction to JSON – InApps Technology is an article under the topic Software Development Many of you are most interested in today !! Today, let’s InApps.net learn An Introduction to JSON – InApps Technology in today’s post !

Read more about An Introduction to JSON – InApps Technology at Wikipedia



You can find content about An Introduction to JSON – InApps Technology from the Wikipedia website

JSON stands for JavaScript Object Notation. It is a data format interchange, which is a fancy means of saying it’s a way of storing and transferring data. It has become widely deployed for quite a large number of use cases. And although the name implies JavaScript, JSON is used with other languages, such as Python, Ruby, PHP, and Java. More important, however, the JSON format is also used for Docker and Kubernetes manifests, so it’s absolutely crucial to understand how JSON works for anyone interested in cloud native development.

JSON came about as a subset of JavaScript in December of 1999 when object literals and array literals were added to JavaScript. JSON quickly became language-independent, such that almost every programming language was capable of parsing JSON data.

JSON wasn’t really invented by anyone in particular, as a number of different people realized how functional this data transfer/storage system would work. The term “JSON,” however, was coined by Atari employee Douglas Crockford. In 2002, Crockford went on to register the json.org domain. Crockford had become quite an important figure in technology (working at companies like Paypal), so his voice was instrumental in spreading the JSON word.

However, it wasn’t until the advent of the Single Page Application (SPA) that JSON usage really exploded, as both mobile and web applications required a seamless interchange of data. This is due to the succinct format of JSON data being considerably more efficient at sending data back and forth to a server, as compared to XML. One of the reasons for that is because JSON is a much more efficient and succinct language.

Read More:   Mentoring Is a Key to Broadening IT Diversity – InApps 2022

Here’s an example of XML:

The JSON code for the above would be something like this:

As you can see, the JSON is not only much easier to write but easier to read.

JSON files use the .json extension but don’t be fooled into thinking you can only use JSON in .json files. In fact, all .yml and .yaml files are written in the JSON format, which (given how many applications and services depend on YAML files) is why it’s important to understand what JSON is and how it’s structured. If you want to deploy a container to a Kubernetes cluster, you’ll be using JSON. Want to build a Dockerfile, that’s right, you’re using JSON. There are even configuration files for desktop and server applications that depend on the JSON format.

Speaking of which…

JSON Structure

JSON files (be they .json, .yaml, or just about any file that depends on JSON) are built with two primary components:

  • A collection of name/value pairs.
  • An ordered list of values.
Read More:   Cloud Foundry Outsources its Foundation as Open Source Management Continues to Evolve – InApps Technology 2022

The structure of a JSON file is very much dependent on key-value pairs. Let’s say you want to build a JSON structured file that includes information about a user. That structure might look like this:

In the above example, we have four key-value pairs:

  • f_name – Jack
  • l_name – Wallen
  • gender – Mail
  • profession – Writer

Each pair is always set up in the form:

“key” : “value”

Both keys and values must be wrapped in double quotes. Keys always go to the left side of the colon and values on the right. Within each object, every key must be unique and can contain spaces. So, instead of “f_name”, you could use “first name”. However, I always avoid using spaces in keys, as it can get confusing.

Values are found on the right side of the colon and must be one of six data types:

  • Strings
  • Numbers
  • Objects
  • Arrays
  • Booleans
  • Null

You can also create a key-value pair using a nested object. Such a structure might look like this:

Above we have a key of “user” and a nested list of key-value pairs, consisting of “f_name”, “l_name”, “gender”, and “profession.

We can also use arrays within our key-value pairs. Arrays are housed with [ ]. Let’s continue with our example above, but we’ll add two more values to the “profession” key with an array. That would look like this:

Both of these examples bring up a very important point—indention. One of the caveats to using the JSON format is that indention absolutely must be consistent. As you can see above, my braces line up with one another as do my nested key-value pairs. If your indention isn’t consistent, whatever you’re using the JSON format for will not work. This is often a very challenging bit to debug, especially when your JSON-formatted manifests grow in length and complexity. Because of this, it’s always important that you indent with consistency from the very beginning.

Read More:   Facebook Yarn Unravels Dependency Management Issues for JavaScript Packages – InApps 2022

JSON format can also be written out in a single line. Let’s take, for example, our “user” object. Instead of writing it out this way:

We can write it as a single-line string like so:

Although you might think the above is easier to write out, in very long documents (especially when an array can become rather lengthy), the multi-line format is much easier to manage. This is especially so when crafting very complex container manifests.

Today, JSON is used everywhere: in SPAs, in local application configurations, in container manifests, in cloud native development, and APIs. You name it, and JSON is probably a part of it.

InApps Technology is a wholly owned subsidiary of Insight Partners, an investor in the following companies mentioned in this article: Docker.



Source: InApps.net

Rate this post
As a Senior Tech Enthusiast, I bring a decade of experience to the realm of tech writing, blending deep industry knowledge with a passion for storytelling. With expertise in software development to emerging tech trends like AI and IoT—my articles not only inform but also inspire. My journey in tech writing has been marked by a commitment to accuracy, clarity, and engaging storytelling, making me a trusted voice in the tech community.

Let’s create the next big thing together!

Coming together is a beginning. Keeping together is progress. Working together is success.

Let’s talk

Get a custom Proposal

Please fill in your information and your need to get a suitable solution.

    You need to enter your email to download

      [cf7sr-simple-recaptcha]

      Success. Downloading...