Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Loops, Arrays and Objects Tracking Data Using Objects JavaScript Object Notation

JSON?

What is JSON? Why, when and where to use? I am confused.

2 Answers

Eric M
Eric M
11,517 Points

JavaScript Object Notation is a flexible syntax for defining data structures. Despite the name it is used by multiple programming languages.

Its most common use case is in system to system communications over the internet. Many REST APIs send and receive payloads in JSON. Many also support XML. XML and JSON could be said to be trying to solve similar problems.

That said, when writing JavaScript programs you will often store data in or load data from a JSON format (if you need to store or load data) as well as using JSON for communicating with Web Service APIs.

Watch the Treehouse video Introducing JSON