Skip to content

JSON Converter

Add this converter to read json files as json.

sh
npm add @loom-io/json-converter
sh
pnpm add @loom-io/json-converter
sh
bun add @loom-io/json-converter

Usage

Under the hood the json converter fits the standard JSON.parse and JSON.stringify and just reads the data from file as text. So the benefits are mainly existing in combination with the CombinedConverter

ts
import { createJsonConverter } from "@loom-io/json-converter";

const jsonFile = adapter.file("some/yaml/file.json");
const converter = createJsonConverter();
const data = await converter.parse(jsonFile);
data.val = "test";
await converter.unify(jsonFile, data);