O'Reilly logo

JavaScript JSON Cookbook by Ray Rischpater

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Using JSON for Binary Data Transfer

In this chapter, we will discuss the intersection between JSON and binary data. Here, you'll find the following recipes:

  • 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 DataView to access ArrayBuffer
  • Encoding and decoding base64 using an ArrayBuffer
  • Compressing object-body content from a Node.js server built using the express module

Introduction

There are typically two reasons why you might want to think about binary representation when using JSON: either because you need to carry binary ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required