diff options
author | 2023-07-31 12:20:23 -0700 | |
---|---|---|
committer | 2023-07-31 12:20:23 -0700 | |
commit | 404b90badc5856a74c06d04062c850003e28fed5 (patch) | |
tree | 7954623cf4a792db612d0bb229a227c2ff1e9fd8 /docs/guides/runtime/import-json.md | |
parent | 67599f97adc77141331a5f4fc39e4d058dc70b2a (diff) | |
download | bun-404b90badc5856a74c06d04062c850003e28fed5.tar.gz bun-404b90badc5856a74c06d04062c850003e28fed5.tar.zst bun-404b90badc5856a74c06d04062c850003e28fed5.zip |
Add ecosystem guides (#3847)
* Add ecosystem guides
* Update titles
* Rename stric
* Add unlink and fetch guides
* Add formdata guide
* Tweak title
* Moar
Diffstat (limited to 'docs/guides/runtime/import-json.md')
-rw-r--r-- | docs/guides/runtime/import-json.md | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/docs/guides/runtime/import-json.md b/docs/guides/runtime/import-json.md new file mode 100644 index 000000000..3db2daaea --- /dev/null +++ b/docs/guides/runtime/import-json.md @@ -0,0 +1,32 @@ +--- +name: Import a JSON file +--- + +Bun natively supports `.json` imports. + +```json#package.json +{ + "name": "bun", + "version": "1.0.0", + "author": { + "name": "John Dough", + "email": "john@dough.com" + } +} +``` + +--- + +Import the file like any other source file. + +```ts +import data from "./package.json"; + +data.name; // => "bun" +data.version; // => "1.0.0" +data.author.name; // => "John Dough" +``` + +--- + +See [Docs > Runtime > TypeScript](/docs/runtime/typescript) for more information on using TypeScript with Bun. |