json

Bun

Symbol

$.ShellPromise.json

json(): Promise<any>

Read from stdout as a JSON object

Automatically calls quiet

@returns

A promise that resolves with stdout as a JSON object

const output = await $`echo '{"hello": 123}'`.json();
console.log(output); // { hello: 123 }