JavaScript JSON Cookbook

Over 80 recipes to make the most of JSON in your desktop, server, web, and mobile applications
Preview in Mapt

JavaScript JSON Cookbook

Ray Rischpater

3 customer reviews
Over 80 recipes to make the most of JSON in your desktop, server, web, and mobile applications
Mapt Subscription
FREE
$29.99/m after trial
eBook
$25.20
RRP $35.99
Save 29%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$25.20
$44.99
$29.99 p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


JavaScript JSON Cookbook Book Cover
JavaScript JSON Cookbook
$ 35.99
$ 25.20
JavaScript: Functional Programming for JavaScript Developers Book Cover
JavaScript: Functional Programming for JavaScript Developers
$ 63.99
$ 44.80
Buy 2 for $35.00
Save $64.98
Add to Cart

Book Details

ISBN 139781785286902
Paperback192 pages

Book Description

JSON (JavaScript Object Notation) is a lightweight text-based data interchange format used to create objects to transfer data over the Internet. It's widely used today by common web applications, as well as mobile applications.

This book gives you clear ways that you can exchange objects using JSON, regardless of whether you're developing a web or traditional networked application. You'll start with a brief refresher on JSON and JavaScript syntax and read and write on the client and server. Then, you'll learn how to use JSON in simple AJAX applications using AngularJS and jQuery. Next, you will learn how to exchange objects with databases using MongoDB and CouchDB. You'll also explore how to use JSON in a type-safe manner, writing programs that have fewer bugs.

Table of Contents

Chapter 1: Reading and Writing JSON on the Client
Introduction
Reading and writing JSON in JavaScript
Reading and writing JSON in C++
Reading and writing JSON in C#
Reading and writing JSON in Java
Reading and writing JSON in Perl
Reading and writing JSON in Python
Chapter 2: Reading and Writing JSON on the Server
Reading and writing JSON in Clojure
Reading and writing JSON in F#
Reading and writing JSON with Node.js
Reading and writing JSON in PHP
Reading and writing JSON in Ruby
Chapter 3: Using JSON in Simple AJAX Applications
Introduction
Creating an XMLHttpRequest object
Making an asynchronous request for data
Sending JSON to your web server
Accepting JSON using Node.js
Getting the progress of an asynchronous request
Parsing the returned JSON
Issuing a web service request using Node.js
Chapter 4: Using JSON in AJAX Applications with jQuery and AngularJS
Introduction
Adding a dependency to jQuery to your web page
Requesting JSON content using jQuery
Sending JSON to your web server using jQuery
Getting the progress of a request using jQuery
Parsing the returned JSON using jQuery
Adding a dependency to AngularJS to your web page
Requesting JSON content using AngularJS
Sending JSON to your web server using AngularJS
Getting the progress of a request using AngularJS
Parsing the returned JSON using AngularJS
Chapter 5: Using JSON with MongoDB
Introduction
Setting up MongoDB
Installing the MongoDB database driver for Node.js
Installing the express module for Node.js
Connecting to a MongoDB database using Node.js
Creating a document in MongoDB using Node.js
Searching for a document in MongoDB with Node.js
Updating a document in MongoDB with Node.js
Deleting a document in MongoDB using Node.js
Using REST to search MongoDB
Using REST to create a document in MongoDB
Using REST to update a document in MongoDB
Using REST to delete a document in MongoDB
Chapter 6: Using JSON with CouchDB
Introduction
Installing and setting up CouchDB and Cradle
Connecting to a CouchDB database using Node.js and Cradle
Creating a CouchDB database using Node.js and Cradle
Creating a document in CouchDB using Node.js and Cradle
Setting up a data view in CouchDB with Node.js and Cradle
Searching for a document in CouchDB with Node.js and Cradle
Updating a document in CouchDB with Node.js and Cradle
Deleting a document in CouchDB using Node.js and Cradle
Using REST to enumerate CouchDB records
Using REST to search CouchDB
Using REST to upsert a document in CouchDB
Using REST to delete a document in CouchDB
Chapter 7: Using JSON in a Type-safe Manner
Introduction
How to deserialize an object using Json.NET
How to handle date and time objects using Json.NET
How to deserialize an object using gson for Java
How to use TypeScript with Node.js
How to annotate simple types using TypeScript
How to declare interfaces using TypeScript
How to declare classes with interfaces using TypeScript
Using json2ts to generate TypeScript interfaces from your JSON
Chapter 8: Using JSON for Binary Data Transfer
Introduction
Encoding binary data as a base64 string using Node.js
Decoding binary data from a base64 string using Node.js
Encoding and decoding binary data as a base64 string using JavaScript in the browser
Encoding data as BSON using Json.NET
Decoding data from BSON using Json.NET
Using a DataView to access an ArrayBuffer
Encoding and decoding base64 using an ArrayBuffer
Compressing object-body content from a Node.js server built using the express module
Chapter 9: Querying JSON with JSONPath and LINQ
Introduction
Using the JSONPath dot-notation to query JSON documents
Using JSONPath bracket-notation to query JSON documents
Using JSONPath scripting to construct more complicated queries
Using JSONPath in your web application
Using JSONPath in your Node.js application
Using JSONPath in your PHP application
Using JSONPath in your Python application
Using JSONPath in your Java application
Using JSONPath with SelectToken to query for JSONPath expressions in your C# application
Using LINQ with Json.NET to query JSON in your C# application
Chapter 10: JSON on Mobile Platforms
Introduction
Parsing JSON on Android
Generating JSON on Android
Parsing JSON on iOS in Objective-C
Generating JSON on iOS in Objective-C
Parsing JSON on iOS using Swift
Generating JSON on iOS using Swift
Parsing JSON using Qt
Generating JSON using Qt

What You Will Learn

  • Learn to use JSON in a type-safe way to avoid common data typing errors
  • Exchange data with NoSQL databases such as MongoDB and CouchDB with JSON
  • Make the most of JSON in AJAX web applications, with or without a framework
  • Exchange data between servers and mobile applications running on Android and iOS with JSON
  • Practical examples to show you how to leverage JSON from a variety of application domains

Authors

Table of Contents

Chapter 1: Reading and Writing JSON on the Client
Introduction
Reading and writing JSON in JavaScript
Reading and writing JSON in C++
Reading and writing JSON in C#
Reading and writing JSON in Java
Reading and writing JSON in Perl
Reading and writing JSON in Python
Chapter 2: Reading and Writing JSON on the Server
Reading and writing JSON in Clojure
Reading and writing JSON in F#
Reading and writing JSON with Node.js
Reading and writing JSON in PHP
Reading and writing JSON in Ruby
Chapter 3: Using JSON in Simple AJAX Applications
Introduction
Creating an XMLHttpRequest object
Making an asynchronous request for data
Sending JSON to your web server
Accepting JSON using Node.js
Getting the progress of an asynchronous request
Parsing the returned JSON
Issuing a web service request using Node.js
Chapter 4: Using JSON in AJAX Applications with jQuery and AngularJS
Introduction
Adding a dependency to jQuery to your web page
Requesting JSON content using jQuery
Sending JSON to your web server using jQuery
Getting the progress of a request using jQuery
Parsing the returned JSON using jQuery
Adding a dependency to AngularJS to your web page
Requesting JSON content using AngularJS
Sending JSON to your web server using AngularJS
Getting the progress of a request using AngularJS
Parsing the returned JSON using AngularJS
Chapter 5: Using JSON with MongoDB
Introduction
Setting up MongoDB
Installing the MongoDB database driver for Node.js
Installing the express module for Node.js
Connecting to a MongoDB database using Node.js
Creating a document in MongoDB using Node.js
Searching for a document in MongoDB with Node.js
Updating a document in MongoDB with Node.js
Deleting a document in MongoDB using Node.js
Using REST to search MongoDB
Using REST to create a document in MongoDB
Using REST to update a document in MongoDB
Using REST to delete a document in MongoDB
Chapter 6: Using JSON with CouchDB
Introduction
Installing and setting up CouchDB and Cradle
Connecting to a CouchDB database using Node.js and Cradle
Creating a CouchDB database using Node.js and Cradle
Creating a document in CouchDB using Node.js and Cradle
Setting up a data view in CouchDB with Node.js and Cradle
Searching for a document in CouchDB with Node.js and Cradle
Updating a document in CouchDB with Node.js and Cradle
Deleting a document in CouchDB using Node.js and Cradle
Using REST to enumerate CouchDB records
Using REST to search CouchDB
Using REST to upsert a document in CouchDB
Using REST to delete a document in CouchDB
Chapter 7: Using JSON in a Type-safe Manner
Introduction
How to deserialize an object using Json.NET
How to handle date and time objects using Json.NET
How to deserialize an object using gson for Java
How to use TypeScript with Node.js
How to annotate simple types using TypeScript
How to declare interfaces using TypeScript
How to declare classes with interfaces using TypeScript
Using json2ts to generate TypeScript interfaces from your JSON
Chapter 8: Using JSON for Binary Data Transfer
Introduction
Encoding binary data as a base64 string using Node.js
Decoding binary data from a base64 string using Node.js
Encoding and decoding binary data as a base64 string using JavaScript in the browser
Encoding data as BSON using Json.NET
Decoding data from BSON using Json.NET
Using a DataView to access an ArrayBuffer
Encoding and decoding base64 using an ArrayBuffer
Compressing object-body content from a Node.js server built using the express module
Chapter 9: Querying JSON with JSONPath and LINQ
Introduction
Using the JSONPath dot-notation to query JSON documents
Using JSONPath bracket-notation to query JSON documents
Using JSONPath scripting to construct more complicated queries
Using JSONPath in your web application
Using JSONPath in your Node.js application
Using JSONPath in your PHP application
Using JSONPath in your Python application
Using JSONPath in your Java application
Using JSONPath with SelectToken to query for JSONPath expressions in your C# application
Using LINQ with Json.NET to query JSON in your C# application
Chapter 10: JSON on Mobile Platforms
Introduction
Parsing JSON on Android
Generating JSON on Android
Parsing JSON on iOS in Objective-C
Generating JSON on iOS in Objective-C
Parsing JSON on iOS using Swift
Generating JSON on iOS using Swift
Parsing JSON using Qt
Generating JSON using Qt

Book Details

ISBN 139781785286902
Paperback192 pages
Read More
From 3 reviews

Read More Reviews

Recommended for You

JavaScript: Functional Programming for JavaScript Developers Book Cover
JavaScript: Functional Programming for JavaScript Developers
$ 63.99
$ 44.80
Python Machine Learning - Second Edition Book Cover
Python Machine Learning - Second Edition
$ 31.99
$ 22.40
Python GUI Programming Cookbook - Second Edition Book Cover
Python GUI Programming Cookbook - Second Edition
$ 39.99
$ 28.00
JavaScript: Functional Programming for JavaScript Developers Book Cover
JavaScript: Functional Programming for JavaScript Developers
$ 63.99
$ 44.80
Mastering Node.js - Second Edition Book Cover
Mastering Node.js - Second Edition
$ 39.99
$ 28.00
Angular 2 By Example Book Cover
Angular 2 By Example
$ 35.99
$ 25.20