Could not load font.typeface.json

I tried to load json font file to three.js fontLoader but I got this error

Uncaught SyntaxError: Unexpected string in JSON at position 1
    at JSON.parse (<anonymous>)
    at Object.onLoad (FontLoader.js:34)
    at XMLHttpRequest.<anonymous> (three.module.js:38713)

and it is the case with every diffrent font.json I tried
and there is no errors inside the font file

most likely wrong path. whatā€™s the path you used? it canā€™t start with ./ or ā€¦/

the path I used is : ā€˜./fonts/Debrosee-ALPnL-msdf.jsonā€™

the fonts folder and the Text.js in which the code above declaired are in the same directory
i removed the ./ but it still the same

that is not a valid path. the file either has to be in your public folder (and now the path has to start with ā€œ/ā€) or you need to import the file.

1 Like

I see, thank you very much it worked finally.

Open ā€˜Debrosee-ALPnL-msdf.jsonā€™ file in notepad and check whatā€™s inside.

It should be something like thisā€¦ I faced the same problem and found I have not saved the json file properly.