O'Reilly logo

Scalatra in Action by Stefan Ollinger Dave Hrycyszyn Ross A. Baker

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 5. Handling JSON

This chapter covers

  • Consuming and producing JSON using the Scalatra JSON module
  • Handling heterogeneity when working with JSON
  • Using JSONP

JSON is a common data interchange format for semistructured data. It’s human-readable and supports primitive, array, and object values. Additionally, for web services it’s the natural data format of the browser, due to its close relationship with JavaScript.

Scalatra offers a module that supports an application working with JSON. This chapter covers its use with practical examples taken from the food domain. Who knows, maybe you’ll also learn a useful recipe!

5.1. Introducing JsonSupport

The Scalatra JSON module extends an application’s request handling with two facets:

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