// file data.json { "localItems": { "items": [ { "title": "Halabut", "type": "string", "status": false }, { "title": "Taco", "type": "string", "status": true }, { "title": "Fish", "type": "string", "status": true }, { "title": "Pork", "type": "string", "status": false } ] } } //js file must be a module // <script src="scripts.js" defer type="module"></script> // JS file import data from "./data.json" assert { type: "json" }; const {localItems} = data; const JSONDATA = localItems['items'];
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter