Typing for JSON Payloads

This page summarizes the projects mentioned and recommended in the original post on /r/typescript

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • zod

    TypeScript-first schema validation with static type inference

  • I think you want something like zod for this.

  • typebox

    Json Schema Type Builder with Static Type Resolution for TypeScript

  • typebox - https://github.com/sinclairzx81/typebox

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • typescript-is

  • I'll throw https://github.com/woutervh-/typescript-is in the mix as well.

  • ajv

    The fastest JSON schema Validator. Supports JSON Schema draft-04/06/07/2019-09/2020-12 and JSON Type Definition (RFC8927)

  • If you are ingesting data from a 3rd party api you probably want to use a validation library to validate the payload and type it. Especially if it’s undocumented. We use Ajv at my current job and it’s pretty awesome. https://ajv.js.org/

  • tiny-schema-validator

    JSON schema validator

  • It's an NPM package tiny-schema-validator

  • runtypes

    Runtime validation for static types

  • Also runtypes and (as mentioned below) zod.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts