How to Import a JSON File in create-react-app?

create-react-app supports importing JSON files right out-of-the-box. For example, you can import a JSON file in the following way:

import products from '../path/to/products.json';

This works because create-react-app uses webpack internally, which (from version 2+) includes json-loader by default.


Hope you found this post useful. It was published . Please show your love and support by sharing this post.