#How to store json under variable (MAPBOX)
6 messages · Page 1 of 1 (latest)
If you are using a template from Mapbox and trying to use your own GeoJSON data, you can store your GeoJSON data in a JavaScript file and import it into your project. Here is an example of how you can do this:
First, create a JavaScript file called myGeoJSONData.js and add your GeoJSON data to it like this:
const myGeoJSONData = {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
properties: {},
geometry: {
type: 'Point',
coordinates: [30.5, 50.5]
}
},
]
};
export default myGeoJSONData;```
Then, in the file where you want to use your GeoJSON data, import it like this:
```js
import myGeoJSONData from './myGeoJSONData';```
You can then use the `myGeoJSONData` variable in your code to access your GeoJSON data
Thank you! 
so use require()
give me the photo please
code photo
you will write in the section that says “coordinates”