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

x/lume/core/loaders/json.ts

πŸ”₯ Static site generator for Deno πŸ¦•
Very Popular
Go to Latest
File
import { isPlainObject } from "../utils.ts";
import type { Data } from "../../core.ts";
/** Load and parse a JSON file */export default async function (path: string): Promise<Data> { const text = await Deno.readTextFile(path); const content = JSON.parse(text);
if (!content) { return {}; }
if (isPlainObject(content)) { return content as Data; }
return { content };}