function uploadJsonFunction(){
var jsonURL = "C:\Users\My Documents\new\WebContent\JsonFiles\TreeJson\countries.json";
}
Here is my Json:
{
identifier: 'id',
label: 'name',
items: [
{
id: 'AF',
name: 'Africa',
type:'continent'
}
]
}
We can read this JSON data in JavaScript using the import statement this way: <! ---./index. js--> import data from './data.
To get JSON from the server using the Fetch API, you can use the response. json() method. The response. json() method reads the data returned by the server and returns a promise that resolves with a JSON object.
$.ajax({
url: "\countries.json",
success: function (data) {
var obj = JSON.parse(data);
}
});
For safety reasons, The C:\Users\My Documents\new\WebContent\JsonFiles\TreeJson\countries.json
url won't work in a browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With