Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
JavaScript and JSON Essentials

You're reading from   JavaScript and JSON Essentials Build light weight, scalable, and faster web applications with the power of JSON

Arrow left icon
Product type Paperback
Published in Apr 2018
Publisher
ISBN-13 9781788624701
Length 226 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Sai S Sriparasa Sai S Sriparasa
Author Profile Icon Sai S Sriparasa
Sai S Sriparasa
Bruno Joseph D'mello Bruno Joseph D'mello
Author Profile Icon Bruno Joseph D'mello
Bruno Joseph D'mello
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Getting Started with JSON 2. The JSON Structures FREE CHAPTER 3. AJAX Requests with JSON 4. Cross-Domain Asynchronous Requests 5. Debugging JSON 6. Building the Carousel Application 7. Alternate Implementations of JSON 8. Introduction to hapi.js 9. Storing JSON Documents in MongoDB 10. Configuring the Task Runner Using JSON 11. JSON for Real-Time and Distributed Data 12. Case Studies in JSON 13. Other Books You May Enjoy

Accessing objects in JSON

Now that we understand how to make a script call to fetch an external JavaScript file, let us use the same technique to import a JSON feed. I have generated a test employee JSON data feed with 100 records. To traverse through any JSON feed, it is important to make a note of how the data is arranged. The keys in this data feed are basic employee information such as employee number, date of birth, first name, last name, gender, hire date, titles that they have held, and the dates during which they have held those titles. A few employees have held the same title throughout their tenure, while there are some employees who have held more than one title.

This JSON file will be part of the code files for exercises.

Consider the following JSON store that we need to use to perform the operations:

let data_json = [
{
"emp_no" : "10001",
...
You have been reading a chapter from
JavaScript and JSON Essentials - Second Edition
Published in: Apr 2018
Publisher:
ISBN-13: 9781788624701
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime