DO YOU NEED A CONTENT WRITER FOR YOUR BUSINESS?

Your One-Stop Solution for All Content Needs! Click here for more!
Json

Syntax of JSON

Share

Basically Syntax of JSON is the subset of the JavaScript syntax.

It has following notation:

  • Data is represented in name/value pairs.
  • The name/value pairs are separated by , (comma).
  • Curly braces hold objects.
  • Square brackets hold arrays.

Below is a example of Syntax of JSON:

{"students":[
 {"Name":"Tim", "Age":"25"},
 {"Name":"John", "Age":"30"},
 {"Name":"Jane", "Age":"45"}
 ]}

So,
students[0].Name + “:” + Name[0].Age;

will be Tim:25

The following datatypes are supported by JSON:
Number, String, Boolean, Array, Object, Whitespace, null

Read Also: Json JSON with Ajax

JSON reads data from a web server, and display in a web page.

var text = ‘{“students”:[
{“Name”:”Tim”, “Age”:”25″},
{“Name”:”John”, “Age”:”30″},
{“Name”:”Jane”, “Age”:”45″}
]}’;

Object From String:
JSON.parse(text) can be used to convert a JSON string into a JavaScript object:
var obj = JSON.parse(text);

Using eval():
You can use eval() function to convert a JSON string into a JavaScript object:
var obj = eval (“(” + text + “)”);

JSON is not a document format and this is not a markup language. Even, this is not a general serialization format in that it does not have a direct representation for cyclical structures, although it can support a meta representation that does.

JSON is not extensible and it does not need to be. It can represent any non-recurrent data structure as it is. JSON is a flexible as new fields can be added to existing structures without obsoleting existing programs.
In this sense, XML is also not extensible. This is possible to add new tags and attributes, but this is not possible to extend XML to add expressive syntax for arrays and objects and numbers and Booleans.

Namaste UI (Author)

Namaste UI collaborates closely with clients to develop tailored guest posting strategies that align with their unique goals and target audiences. Their commitment to delivering high-quality, niche-specific content ensures that each guest post not only meets but exceeds the expectations of both clients and the hosting platforms. Connect with us on social media for the latest updates on guest posting trends, outreach strategies, and digital marketing tips. For any types of guest posting services, contact us on info[at]namasteui.com.

View Comments

  • This is the right web site for everyone who wishes to find out about this topic. You know a whole lot its almost hard
    to argue with you (not that I actually would want to? HaHa). You certainly put a fresh spin on a topic that has been written about for years.
    Great stuff, just excellent!

Published by
Namaste UI (Author)

Recent Posts

Why is SEO a non-negotiable part of modern marketing?

In a world where digital presence is paramount, the question isn't whether you should do…

9 hours ago

Innovations in Hair Care: Exploring Breakthroughs for Lasting Results

Over the years, people have experimented with various methods to maintain healthy and beautiful hair.…

1 day ago

How To Strengthen Your Brand-Building Efforts?

Your brand more than developing an attractive and creative logo and infectious motto. It's the…

2 days ago

How To Be Successful And Maximize Compensation In A Personal Injury Case

Introduction Are you someone who has suffered from a personal injury and want to file…

2 days ago

What Are The Biggest Challenges Of Working From Home?

Operating from home has emerged as one of the most popular ways of doing jobs…

3 days ago

Art As An Asset: Will NFT’s Help You Survive Hyperinflation?

If the consequences of our society’s ever-growing debt are what worries you, then it is…

5 days ago