I have this code:
<script>
import { onMount } from "svelte";
// Get config
fetch("./config.gb.js", {
    method: "GET",
    headers: {
        "Content-Type": "application/json"
    }
})
.then(res => {
    if (!res.ok) {
        throw new Error("404!");
    }
    return res.json();
})
// Output data in array
.then(data => {
    let keys = Object.values(data);
    console.log(keys);
    console.log(data);
})
// Catch error
.catch(err => {
    console.log(err);
})
and config.gb.js file looks like this:
var countryCurrencyDefaults = {
countries: [{
    country: {
        name: "Afghanistan",
        active: "Y",
        isoCode: "AF",
        dialCode: 93,
        currencies: [{
            currency: "AFN"
        }, {
            currency: "USD"
        }]
    }
}, {
    country: {
        name: "American Samoa",
        active: "Y",
        isoCode: "AS",
        dialCode: 1,
        currencies: [{
            currency: "USD"
        }]
    }
}, { ... other 240+ countries ... }
How to convert data from .js file to object or json array? I'm struggling to find any info on internet that can help me. I'm working with svelte.js but I guess this doesn't matter much.
