Live Chat Icon For mobile
Live Chat Icon

How do I load a JSON file in the client-side of the Blazor app without making a request to server?

Platform: Blazor| Category : General, Tips and Tricks

To load a JSON file in Blazor, refer to the following code.

<script src="https://code.jquery.com/jquery-3.4.1.min.js"
        integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
        crossorigin="anonymous"></script>
<script type="text/javascript" src="object.json"></script>
<script>
    $.getJSON("object.json", function (json) {
        console.log(json); 
    });
</script>

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.