Chapter 7. Using JSON in a Type-safe Manner

In this chapter, we build on the recipes from Chapter 1, Reading and Writing JSON on the Client, showing you how you can use strong typing in your applications with JSON using C#, Java, and TypeScript. You'll find the following recipes:

  • 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

Introduction

While some say that strong types are for weak minds, the truth is that strong typing ...

Get JavaScript JSON Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.