Skip to content

Instantly share code, notes, and snippets.

@jlengstorf
Created May 21, 2012 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlengstorf/2760326 to your computer and use it in GitHub Desktop.
Save jlengstorf/2760326 to your computer and use it in GitHub Desktop.
#5 Code example from "JSON: What It Is, How It Works, & How to Use It"
var family = {
"jason" : {
"name" : "Jason Lengstorf",
"age" : "24",
"gender" : "male"
},
"kyle" : {
"name" : "Kyle Lengstorf",
"age" : "21",
"gender" : "male"
}
}
@mkim17
Copy link

mkim17 commented Jun 18, 2015

Hey Jason, just wondering, does the last close curly brace on line 12 need a semicolon after it? Thank you for the tutorial by the way, it's been very helpful and intuitive

@namansancheti
Copy link

Same doubt...there should be a semicolon, isn't it..?

@zia-ict
Copy link

zia-ict commented Jun 26, 2015

a semicolon is needed after curly brace on line 12.

@saif-ur-rehman
Copy link

Thanks for this helpful explanation

@Lc0rE
Copy link

Lc0rE commented Jul 30, 2015

If you paste the code on http://jsonlint.com/ (without the var family =), he will give back an error with the semicolon at the line 12. Are we sure it is correct?

@5ervant
Copy link

5ervant commented Aug 7, 2015

A semicolon after the curly brace on line 12 is optional: https://jsfiddle.net/0y36hbhg/
Just like a console.debug() that's not ending with a semicolon but putting a semicolon after an executable line or block is highly recommended, it's proper coding practice.

Copy link

ghost commented Sep 12, 2015

How can I display all the data of objects inside this object in for-in loop to show in one page , like this example
https://gist.github.com/MohamDev/e064e49b10bd83d1af92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment