JavaScript and JSON Essentials
eBook - ePub

JavaScript and JSON Essentials

Sai Srinivas Sriparasa

Share book
  1. 120 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

JavaScript and JSON Essentials

Sai Srinivas Sriparasa

Book details
Book preview
Table of contents
Citations

About This Book

In Detail

The exchange of data over the Internet has been carried out since its inception. Delimiter-separated lists such as CSV and tag-separated languages such as XML are very popular, yet they are considered to be verbose by a section of developers. JSON (JavaScript Object Notation) is a lightweight text-based code to create objects to transfer data over the Internet. It is a data exchange format that is human-readable (like XML, but without the markup around your actual payload) and its syntax is a subset of the JavaScript language that was standardized in 1999.

JavaScript and JSON Essentials is a step-by-step guide that will introduce you to JSON and help you understand how the lightweight JSON data format can be used in different ways either to store data locally or to transfer data over the Internet. This book will teach you how to use JSON effectively with JavaScript.

This book begins with a brief refresher course on JavaScript before taking you through how JSON data can be transferred via synchronous, asynchronous, and cross-domain asynchronous HTTP calls. JSON is not just about data transfer; this book throws light on the alternate implementations of JSON as well.

You will learn the data types that JavaScript uses and how those data types can be used in JSON. You will go through the concepts of how to create, update, parse, and delete a JSON object. You will also look at the different techniques of loading a JSON file onto a web page, how to use jQuery to traverse through an object, and how to perform access operations. You will also go over a few resources that will make debugging JSON quick and easy.

Approach

The book follows a tutorial-based approach and will teach you how to work with JSON tools, design JSON objects, and how to use different techniques to handle JSON data.

Who this book is for

This book is a great resource for developers who would like to learn more about JSON and who wish to apply it in their own projects. It will be useful to have some prior knowledge of HTML and JavaScript to help you understand the concepts covered in this book. Some familiarity with a server-side language such as PHP, C#, or Python would also be beneficial, but this is not compulsory.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is JavaScript and JSON Essentials an online PDF/ePUB?
Yes, you can access JavaScript and JSON Essentials by Sai Srinivas Sriparasa in PDF and/or ePUB format, as well as other popular books in Ciencia de la computación & Programación web. We have over one million books available in our catalogue for you to explore.

Information

Year
2013
ISBN
9781783286034

JavaScript and JSON Essentials


Table of Contents

JavaScript and JSON Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. JavaScript Basics
Variables in JavaScript
Arrays
Objects
The Carousel application
Summary
2. Getting Started with JSON
The Hello World program with JSON
Datatypes in JSON
Languages that support JSON
PHP
Python
Summary
3. Working with Real-time JSON
Accessing objects in JSON
Performing complex operations
Modifying JSON
Summary
4. AJAX Calls with JSON Data
Requirements for AJAX
Hosting JSON
Making your first AJAX call
Parsing JSON data
Summary
5. Cross-domain Asynchronous Requests
Making GET and POST AJAX calls with JSON data
The problem with cross-domain AJAX calls
Introduction to JSONP
Implementing JSONP
Summary
6. Building the Carousel Application
Setting up the application
Building the JSON file for the Carousel application
Creating the Carousel application with jQuery Cycle
Summary
7. Alternate Implementations of JSON
Dependency management
JSON for storing metadata
Comparisons with YAML
Summary
8. Debugging JSON
Using the developer tools
Validating JSON
Formatting JSON
Summary
Index

JavaScript and JSON Essentials

Copyright © 2013 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: October 2013
Production Reference: 1181013
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78328-603-4
www.packtpub.com
Cover image by Ravaji Babu ()

Credits

Author
Sai Srinivas Sriparasa
Reviewers
Marco Lüthy
Shameera Rathnayaka
Acquisition Editor
Joanne Fitzpatrick
Lead Technical Editor
Shaon Basu
Technical Editors
Pooja Nair
Anusri Ramchandran
Amit Shetty
Ritika Singh
Copy Editors
Alisha Aranha
Brandt D’Mello
Lavina Pereira
Project Coordinator
Akash Poojary
Proofreader
Ting Baker
Indexer
Monica Ajmera Mehta
Production Coordinator
Kirtee Shingan
Cover Work
Kirtee Shingan

About the Author

Sai Srinivas Sriparasa is a web developer and an open source evangelist living in the Stamford area. Sai was the lead developer for building Dr. Oz’s website, and has led teams for companies such as Sprint Nextel, West Interactive, and Apple. Sai’s repertoire includes JavaScript, PHP, Python, HTML5, responsive web development, ASP.NET, C#, and Silverlight.

About the Reviewers

Marco Lüthy is a Swiss-born creator, designer, developer, and engineer for Internet-enabled applications and has over 10 years of experience working on projects deployed over the Internet. Occasionally he likes to dabble in content creation of the written and photographic kind. Marco’s current focus is the Tokyo-based Internet media and application development firm Robotag Media, Inc., where he is co-founder and resident factotum working on making many useful, pretty things for us all to use and play with.
Shameera Rathnayaka is an Apache Axis2 committer and a PMC member, and has been actively contributing to several Apache projects for the past few years. He holds a B.Sc. Engineering (Hons) in Computer Science and Engineering from the University of Moratuwa, Sri Lanka. He first started his open source contributions with the Apache Axis2 project, where he implemented JDK 7 Enum support for Apache Axis2 as well as stream-based high performance solutions for JSON<-->XML lossless transformation. He is a Google Summer of Code participant with Apache Axis2 and Apache Airavata projects and has reviewed the book Instant GSON, Sandeep Kumar Patel, Packt Publishing.
Shameera currently works as a Software Engineer at WSO2 Inc., an open...

Table of contents