0

Is there a way to locally access .json files using something like:

    $.getJSON("example.json", function(example){
    // do something
    });

but in Eclipse? I want to use Eclipse because there are java components that already exist in the project and are loaded up in Eclipse. I saw similar questions like this but there seems to only be solutions for Java. I am also very new to Javascript so I'm open to other more elegant solutions as well.

6
  • is the example.json in the root or in a specific directory? Commented Aug 17, 2017 at 18:51
  • It is in a specific directory Commented Aug 17, 2017 at 18:52
  • and when you run the application it is hosted on localhost right? in that case instead of example.json mention the entire file path from the root like /name_of_directory_containing_the_json/example.json. Hope it helps Commented Aug 17, 2017 at 18:57
  • do the above mentioned changes work? Commented Aug 18, 2017 at 20:29
  • I solved my issue using a different approach... but thanks for the comments and advice! Commented Aug 18, 2017 at 20:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.