JSON-to-Figma icon indicating copy to clipboard operation
JSON-to-Figma copied to clipboard

Fetch json from Clipboard link doesn't work

Open lambaek opened this issue 4 years ago • 10 comments

Trying with https://jsonplaceholder.typicode.com/todos/1 returns "It is not a link"

isLocalhost.tsx:13 It is not a link App.tsx:30 SyntaxError: Unexpected token T in JSON at position 0 showErrorMsg @ App.tsx:30 (anonymous) @ App.tsx:59 (anonymous) @ fetchJSONfromURL.tsx:23 Promise.catch (async) (anonymous) @ fetchJSONfromURL.tsx:22 (anonymous) @ fetchJSONfromURL.tsx:7 ./src/app/utils/fetchJSONfromURL.tsx.__awaiter @ fetchJSONfromURL.tsx:3 fetchJSONfromURL @ fetchJSONfromURL.tsx:15 fetchUrlLink @ App.tsx:54 callCallback @ react-dom.development.js:188 invokeGuardedCallbackDev @ react-dom.development.js:237 invokeGuardedCallback @ react-dom.development.js:292 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:306 executeDispatch @ react-dom.development.js:389 executeDispatchesInOrder @ react-dom.development.js:414 executeDispatchesAndRelease @ react-dom.development.js:3278 executeDispatchesAndReleaseTopLevel @ react-dom.development.js:3287 forEachAccumulated @ react-dom.development.js:3259 runEventsInBatch @ react-dom.development.js:3304 runExtractedPluginEventsInBatch @ react-dom.development.js:3514 handleTopLevel @ react-dom.development.js:3558 batchedEventUpdates$1 @ react-dom.development.js:21871 batchedEventUpdates @ react-dom.development.js:795 dispatchEventForLegacyPluginEventSystem @ react-dom.development.js:3568 attemptToDispatchEvent @ react-dom.development.js:4267 dispatchEvent @ react-dom.development.js:4189 unstable_runWithPriority @ scheduler.development.js:653 runWithPriority$1 @ react-dom.development.js:11039 discreteUpdates$1 @ react-dom.development.js:21887 discreteUpdates @ react-dom.development.js:806 dispatchDiscreteEvent @ react-dom.development.js:4168

lambaek avatar Oct 26 '21 10:10 lambaek

Hey @lambaek, have you tried using https://jsonplaceholder.typicode.com/todos/ instead? I belive the data file needs to contain an array rather than an object

shakeelmohamed avatar Dec 06 '21 22:12 shakeelmohamed

Hi @shakeelmohamed , i have also tried with an array and it fails already when trying to fetch the json from the url. Our current workaround is to save our json array into a test.json file, and then import it manually.

When i click the "From clipboard link" button, it gives console error "It is not a link"

lambaek avatar Dec 07 '21 09:12 lambaek

Trying with https://jsonplaceholder.typicode.com/todos/1 returns "It is not a link"

isLocalhost.tsx:13 It is not a link App.tsx:30 SyntaxError: Unexpected token T in JSON at position 0 showErrorMsg @ App.tsx:30 (anonymous) @ App.tsx:59 (anonymous) @ fetchJSONfromURL.tsx:23 Promise.catch (async) (anonymous) @ fetchJSONfromURL.tsx:22 (anonymous) @ fetchJSONfromURL.tsx:7 ./src/app/utils/fetchJSONfromURL.tsx.__awaiter @ fetchJSONfromURL.tsx:3 fetchJSONfromURL @ fetchJSONfromURL.tsx:15 fetchUrlLink @ App.tsx:54 callCallback @ react-dom.development.js:188 invokeGuardedCallbackDev @ react-dom.development.js:237 invokeGuardedCallback @ react-dom.development.js:292 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:306 executeDispatch @ react-dom.development.js:389 executeDispatchesInOrder @ react-dom.development.js:414 executeDispatchesAndRelease @ react-dom.development.js:3278 executeDispatchesAndReleaseTopLevel @ react-dom.development.js:3287 forEachAccumulated @ react-dom.development.js:3259 runEventsInBatch @ react-dom.development.js:3304 runExtractedPluginEventsInBatch @ react-dom.development.js:3514 handleTopLevel @ react-dom.development.js:3558 batchedEventUpdates$1 @ react-dom.development.js:21871 batchedEventUpdates @ react-dom.development.js:795 dispatchEventForLegacyPluginEventSystem @ react-dom.development.js:3568 attemptToDispatchEvent @ react-dom.development.js:4267 dispatchEvent @ react-dom.development.js:4189 unstable_runWithPriority @ scheduler.development.js:653 runWithPriority$1 @ react-dom.development.js:11039 discreteUpdates$1 @ react-dom.development.js:21887 discreteUpdates @ react-dom.development.js:806 dispatchDiscreteEvent @ react-dom.development.js:4168

Here is the problem with the JSON. It should be wrapped in an array like this [{},{},{}]

PavelLaptev avatar Dec 08 '21 12:12 PavelLaptev

Same error with the https://jsonplaceholder.typicode.com/todos/ url

lambaek avatar Dec 08 '21 12:12 lambaek

Hi @shakeelmohamed , i have also tried with an array and it fails already when trying to fetch the json from the url. Our current workaround is to save our json array into a test.json file, and then import it manually.

When i click the "From clipboard link" button, it gives console error "It is not a link"

Hmm... I tried to fetch https://jsonplaceholder.typicode.com/todos and it works

screenshot

PavelLaptev avatar Dec 08 '21 12:12 PavelLaptev

Hmm.. Not sure what i'm doing wrong then...

https://gyazo.com/bdd08c579baba46b5bd283cbaf6cf7e3

lambaek avatar Dec 08 '21 12:12 lambaek

@lambaek seems like it doesn't work in the web version of Figma. Will check it. Did you use app or web version?

screenshot

PavelLaptev avatar Dec 08 '21 13:12 PavelLaptev

Web version

lambaek avatar Dec 08 '21 13:12 lambaek

Web version

Try the app. I'll check how I can fix the issue on the web version

PavelLaptev avatar Dec 08 '21 13:12 PavelLaptev

Web version

Try the app. I'll check how I can fix the issue on the web version

Can confirm the app is working. Looking forward to see if you can fix the web version, as this is the one we mainly use. But a quick fix for now is to have the team download the app.

lambaek avatar Dec 08 '21 13:12 lambaek