parse-json-object

Parse a typed JSON object.
- Returns undefined if unable to parse
- Returns typed JSON object if successful
yarn add parse-json-object
API
import parse, { isJSONObject } from "parse-json-object";
parse(json: string) => JSONObject | undefined;
isJSONObject(json: JSONValue) => boolean;
Types
type JSONObject = {
[x: string]: string | number | boolean | JSONObject | JSONArray | null | undefined;
}
type JSONValue = string | number | boolean | null | JSONObject | JSONArray;
interface JSONArray extends Array<JSONValue> {}