We’ll cover the following:
Performing Ruby/JSON serialization/deserialization with
Working with Ruby Objects and JSON
Understanding the importance of JSON camel casing
Using JSON with Minitest
Making RESTful API calls and testing the results with Minitest and
Building a simple JSON-based API with Rails 5
In our examples, we’ll make RESTful API calls to work with the data we deployed on
Chapter 1. We’ll then create a more realistic JSON-based Web API. But before we develop a
RESTful API, let’s start with the fundamentals of converting between Ruby and JSON.
Several good JSON gems provide Ruby/JSON serialization/deserialization functionality, including these:
The default JSON gem provided in Ruby.
Optimized JSON, considered by many to be the fastest Ruby-based JSON processor available.
Yet Another JSON Library.
There are many other JSON gems in addition to this list, and it’s hard to choose.
Rather than forcing a developer to know how to use each JSON gem,
MultiJson encapsulates this choice by providing a wrapper that invokes the most common ...