Suggestion: Standard Schema support for `readJson`
- Dominant language
- TypeScript
- Stars
- 8
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
It would be very useful if `readJson` (and its derivatives) had support for passing in a [Standard Schema](https://standardschema.dev/schema) to easily validate the JSON:
```ts
import * as v from "valibot";
const PackageJson = v.object({ version: v.string() });
// const { version } = v.parse(PackageJson, path("package.json").readJsonSync());
const { version } = path("package.json").readJsonSync(PackageJson);
```
I'd imagine this being an optional parameter *before* options:
```ts
await readJson(schema);
await readJson(schema, options);
await readJson(options);
```
BTW, this idea is [inspired by Ky](https://github.com/sindresorhus/ky/blob/3419113b48e034fdcf8fa6bd3be3da7b3d0d758f/readme.md?plain=1#L155).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.