JSON

Parcel supports importing JSON and JSON5 files into JavaScript out of the box.

Example usage

#
app.js:
import data from "./data.json";
console.log(data.hello[0]);
// => "world"
data.json:
{
"hello": ["world", "computer"]
}

JSON files are only converted to JavaScript when imported from JavaScript. When referenced from anywhere else, such as from an HTML file or as a URL dependency in JavaScript, they are copied to the output directory as is.