JavaScript expands
into several types and one of them is JSON. It is practical application of
JavaScript to make data interchange easier. What is
JSON? This abbreviation stands for JavaScript Object Notation. Why does
XML relate to JSON? This question is interesting to answer. However, you should
have known the basic concept of XML. This language is part of extended mode of
HTML. XML will be explained in small portion at the last section.
Basic Information about JSON objects
1. JSON attribute
JavaScript is not standalone
language. It needs another language to run. In general implementation,
JavaScript is very fond of HTML due to historical background. Before exploring JSON example, let’s back in time to see the first
development of JavaScript and JSON. JavaScript started to emerge during
Netscape era and JSON was introduced in early 2000. JSON is simplified model of
language program, so it can be understood easily in human-based language. You can find example for JSON easily on
internet. However, the important part is to understand how this language works
properly.
The
JSON format evaluates to JavaScript Objects. JSON started from JavaScript, but expand into several fields.
Basically, this model is not solely language programming, but supportive code
to make data processing easier. Of course, JSON will consist of objects and
properties as similar in JavaScript. Particular implementation of JSON can be
found in closed database application. System only allows authorized members to
access content. Evaluating object means JSON is the object-oriented code.
2. syntax
JSON Syntax Rules are
simple. Developer of this language makes sure everything can be understand
easily. Example of syntax can be seen below:
{
"firstName": "Alex",
"lastName": "Parker",
"age": 29,
"address": {
"streetAddress": "8 3rd
Street",
"city": "London",
"country": "UK",
}
}
JSON
Objects in that example consists of two parts. Firstly, person
is object with properties such as name, age, and address. Second object is
address and it gets properties such as street name, city, and country. That
example is the simplest JSON. You may be familiar with those syntaxes in
several programming language.
Properties are the
object when coming with additional properties. The main properties will be the
part of primary object. In this condition, you can define object through
properties and define properties through their own properties. This concept
make JSON is simple to implement. Of course, everything started from
JavaScript. Therefore, you will understand after several try-outs.
3. converting
In previous
paragraph, XML was mentioned. XML is Extensible Markup language. From the name,
you get brief function of this language. In simple explanation, website will
show data and content using this language. When you hit link then appear
document immediately, that’s one of capability of XML. It shows human-based
language from machine-task. XML is not very flexible due to integrate with
HTML. For such reason, JSON is used to replace old XML. However, you need to
convert it.
Converting
a XML Text to JSON consists of several methods. If
you do not have time to covert it manually, there is online converting do to
such jobs. However, the result can be guaranteed, so you need further
evaluation. Converting manual means you should write the code from beginning.
It is tiresome work when your XML is very big and complex.
0 komentar:
Posting Komentar