ECMAScript proposal: JSON modules

No Comments

Dr. Axel Rauschmayer appears at JSON modules, which is already stay in Chrome 91 (however nothing else). It appears identical to an ES Modules-style import, solely you asset the sort on the finish.

import configData from ‘./config-data.json’ assert {kind: ‘json’};

How good is that? As soon as this makes its approach throughout browsers, we’ve gone on a journey from “you’ll nearly undoubtedly wish to use an Ajax library” due to the cross-browser complexity and weirdness of XMLHttpRequest to the a lot nicer (however you continue to gotta write some code) fetch API, to a one-liner (if what you want is JSON information).

Snagging some JSON information looks as if it needs to be as simple as a one-liner to me, and now it’s. I like how the URL might be dynamic now too.

Direct Hyperlink to ArticlePermalink

The publish ECMAScript proposal: JSON modules appeared first on CSS-Tips. You possibly can assist CSS-Tips by being an MVP Supporter.

    About Marketing Solution Australia

    We are a digital marketing company with a focus on helping our customers achieve great results across several key areas.

    Request a free quote

    We offer professional SEO services that help websites increase their organic search score drastically in order to compete for the highest rankings even when it comes to highly competitive keywords.

    Subscribe to our newsletter!

    More from our blog

    See all posts

    Leave a Comment