Question Concerning Script Folder Access

Viewing 2 reply threads
  • Author
    Posts
  • August 11, 2020 at 6:40 PM #41656

    Rocky Machado
    Participant

    Hi Brendan – The new feature you added on the preference UI. Can I access JSON files using the Utils.getJsonFromUrl function? I was trying the following syntx, but it was not working for me. Could you send me a snipet of code on how to use this new feature?

    let response = Utils.getJsonFromUrl('/Users/alfredojmachado/Documents/sample.json')
    console.log(JSON.stringify(response,null,4));

    thanks,
    rocky

    August 11, 2020 at 8:20 PM #41658

    Brendan
    Keymaster

    Hi Rocky,

    The URL you’ve specified is not a valid URL syntax.

    You would need to use:

    let response = Utils.getJsonFromUrl('file:///Users/alfredojmachado/Documents/sample.json')

    Try that and see if it works. You always need to have a scheme specified for a URL. Whether it’s file:// or https://, tapformz://, and so on.

    Thanks,

    Brendan

    August 11, 2020 at 9:44 PM #41659

    Rocky Machado
    Participant

    That worked. ! I didn’t even think about adding the “file://” makes sense. Thanks again

Viewing 2 reply threads

You must be logged in to reply to this topic.