Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/simple_utility/mod.ts>jsonLoad

Simplify processing for Deno.
Latest
function jsonLoad
import { jsonLoad } from "https://deno.land/x/simple_utility@v2.2.1/mod.ts";

Read JSON file and convert to object. If JSON file does not exist create new file with default value. Argument default value also act as type definition.

Examples

Example 1

import data from "./data.json" with {type: "json"};
const json = await jsonLoad("./data.json", data);

Parameters

path: string
def: T

Returns

Promise<T>