Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

JavaScript and JSON Essentials
JavaScript and JSON Essentials
JavaScript and JSON Essentials
Ebook170 pages1 hour

JavaScript and JSON Essentials

Rating: 4.5 out of 5 stars

4.5/5

()

Read preview

About this ebook

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.

LanguageEnglish
Release dateOct 24, 2013
ISBN9781783286041
JavaScript and JSON Essentials
Author

Sai Srinivas Sriparasa

" 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."

Related to JavaScript and JSON Essentials

Related ebooks

Programming For You

View More

Related articles

Reviews for JavaScript and JSON Essentials

Rating: 4.5 out of 5 stars
4.5/5

6 ratings1 review

What did you think?

Tap to rate

Review must be at least 10 words

  • Rating: 5 out of 5 stars
    5/5
    crisply explained in simple words and pictures are very helpful. the book is not all over the place and is easy to understand.

    1 person found this helpful

Book preview

JavaScript and JSON Essentials - Sai Srinivas Sriparasa

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


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 (<ravaji_babu@outlook.com>)

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.

I want to convey my sincere thanks to the team at Packt Publishing for making this book possible, Shaon, Akash, and Sumeet in particular. This is my first book, so I want to thank all of the readers in advance for having taken the time to read my book. Please contact me on my LinkedIn profile http://www.linkedin.com/in/saisriparasa for networking or for any questions that you have.

My acknowledgments cannot be complete unless I thank my mom, dad, and sister for all their patience and support throughout my life. I hope you all enjoy this book and wish me luck for my next book.

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 source enterprise middleware company based in Sri Lanka, where he is a member of the WSO2 Carbon team. His main research interests are in distributed computing.

www.PacktPub.com

Support files, eBooks, discount offers and more

You might want to visit www.PacktPub.com for support files and downloads related to your book.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

http://PacktLib.PacktPub.com

Do you need instant solutions to your IT questions? PacktLib is Packt’s online digital book library. Here, you can access, read and search across Packt’s entire library of books. 

Why Subscribe?

Fully searchable across every book published by Packt

Copy and paste, print and bookmark content

On demand and accessible via web browser

Free Access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

Preface

JavaScript and JSON Essentials is a one-stop resource that can be used for understanding and implementing JSON in various web applications. This book provides a comprehensive insight into how JSON can

Enjoying the preview?
Page 1 of 1