How to include json content inside a js variable

时间:2018-02-01 18:32:19

标签: javascript json

I have this js variable which is parsing a json content inline:

var places = {
    "type": "FeatureCollection",
    "features": [{
        "type": "Feature",
        "properties": {
            "icon": "theatre"
        },
        "geometry": {
            "type": "Point",
            "coordinates": [-77.038659, 38.931567]
        }
    }]
};

I need this content to be inside an external json file since it is a long list to load dynamically.

Can you tell me how to call the json file (the code must be as it is and not parsed)? I tried dozens of solution here but without results :(

Thanks in advance for your help

0 个答案:

没有答案