need help with fetch json files ( from files) in reactjs

I created a jsx for all json files like this
import Vowels from './file'
import consonants from './file'

export const apiObj ={
Vowels, consonants
}
import Vowels from './file'
import consonants from './file'

export const apiObj ={
Vowels, consonants
}
The error im getting is Unexpected token '<' , " <!Doctype"... Is not a valid json My json like this
{
"Vowels" :[
{
"value" : "a"
}
]

}
{
"Vowels" :[
{
"value" : "a"
}
]

}
No description
3 Replies
vic
vicOP5mo ago
Error :
No description
Chris Bolson
Chris Bolson5mo ago
It looks like the path to the file is wrong. In general you should try to use absolute paths, from the root, as a relative path will be relative to the code that is running it which may well not be the same as where the file is defined. Also, it would be much better if you posted the actual code rather than screen captures.
vic
vicOP5mo ago
Ok , So i can't do like import in json And access with objects Or can u tell me a solution , i can't solve this Sorry I done a small mistake , it works now
Want results from more Discord servers?
Add your server