Linked Questions
12 questions linked to/from ES6 modules implementation, how to load a json file
0
votes
1
answer
4k
views
How to import local JSON into React ES6 [duplicate]
After trying to use json-loader with no success, I cant load an array of JSON into my react code, using webpack 1.4 and babel, if that makes a difference.
import data from '../data/item-types.json';
...
0
votes
1
answer
2k
views
Can't import modules(like axios) and json while require can [duplicate]
I have a simple project like this and have already install axios:
The project
In main.js,I tried to import the axios and a json file but throw error:
import axios from 'axios' //SyntaxError: Cannot ...
397
votes
24
answers
587k
views
How to import a JSON file in ECMAScript 6?
How can I access a JSON file in ECMAScript 6?
The following doesn't work:
import config from '../config.json'
This works fine if I try to import a JavaScript file.
https://www.stefanjudis.com/...
184
votes
15
answers
420k
views
Import JSON file in React
I'm new to React and I'm trying to import a JSON DATA variable from an external file. I'm getting the following error:
Cannot find module "./customData.json"
Could some one help me? It works if I ...
55
votes
6
answers
47k
views
tell typescript to compile json files
The typescript compiler works fine when I import a json file using
const tasks = require('./tasks.json')
However, when I run tsc, the output directory does not contain no tasks.json file, causing a ...
2
votes
4
answers
16k
views
Import static JSON data in React
I am trying to load static JSON data to my react app. But, it wan't allow me to load data.
I am using webpack version 4.26.1
It shows me following error:
SyntaxError: src/data/movieData.json: ...
1
vote
3
answers
4k
views
Cannot read json in React.js, unexpected token error
I am unable to get the data from a json file in React.js
I have checked myJSON on JSLINT and use a Windows system.
Am not trying to display it yet just storing in a variable, it is still throwing an ...
3
votes
1
answer
7k
views
Unexpected token < in JSON at position 0 vuejs
I've been looking for how to solve this error but i didn't understand very well how t fix it.
I'm working with lottie-web on a project and i have to set the params of the animation on an object to ...
0
votes
1
answer
2k
views
How to fix “Module build failed: SyntaxError: Unexpected token” error when using JSON file in react?
I am following a react tutorial by Brian holt and i need to import .json file inside my react component like this :
code
When I try to build my project i was getting
ERROR in ./data.json
Module ...
0
votes
1
answer
3k
views
Loading external local json into React and rendering
I have another react newbie question, I am trying to load some json data from an external, local, file called intro.json But I am getting the error default.map is not a function. Any ideas on what I ...
0
votes
1
answer
111
views
ReactJS - Paginating data from DBJSON
I have an app that fetch JSON data from a DB JSON and I want to paginate this data like for an example to show 1 image per page. How can I do it? Here is my DB JSON
db.json file:
"interiores": [
{ ...
0
votes
1
answer
84
views
React--Looping through a json file, filtering based on a property, and grabbing another property if that condition is met
I have a UScsvjson.json file which contains covid cases from a start date to an end date for every county for every US state. This is how it looks (for the most part)
[
{
"UID": ...