@bconnorwhite/json-types

Type checking for json objects

Usage no npm install needed!

<script type="module">
  import bconnorwhiteJsonTypes from 'https://cdn.skypack.dev/@bconnorwhite/json-types';
</script>

README

@bconnorwhite/json-types

dependencies typescript npm

Type checking for json objects

yarn add @bconnorwhite/json-types

API

import { isJSONObject, JSONObject, JSONValue, JSONArray } from "@bconnorwhite/json-types";

isJSONObject(object?: JSONValue): boolean;

type JSONObject = {
  [key in string]?: JSONValue
};

type JSONValue = string | number | boolean | null | JSONObject | JSONArray;

interface JSONArray extends Array<JSONValue> {};