[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

JSON and brackets

Posted on 2014-07-14
3
Medium Priority
?
257 Views
Last Modified: 2014-07-14
There is a web service that returns the following:

[{"1":444}]

What is the difference between this JSON structure, and the following one:

{"1":444}

Open in new window


without the hard brackets.

What do the hard brackets represent?
0
Comment
Question by:Anthony Lucia
3 Comments
 
LVL 21

Assisted Solution

by:Randy Poole
Randy Poole earned 668 total points
ID: 40195291
The square brackets specify an array.  where the { brackets specify an object.  So in the first response you could get back more then 1 object
0
 
LVL 83

Assisted Solution

by:leakim971
leakim971 earned 664 total points
ID: 40195313
var json = [{"1":444}];
var j1 = json[0];
alert( j1[1] ); // alert 444

Open in new window


VS :
var j1 = {"1":444};
alert( j1[1] ); // alert 444

Open in new window

0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 668 total points
ID: 40195344
The JSON specification is a good place to go to understand all of the syntax you might encounter.
0

Featured Post

Automating Your MSP Business

The road to profitability.
Delivering superior services is key to ensuring customer satisfaction and the consequent long-term relationships that enable MSPs to lock in predictable, recurring revenue. What's the best way to deliver superior service? One word: automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month19 days, 17 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question