API call from local JSON file

Hi all… I am very new to ember, this seems like it would be a very easy and obvious solution but I am having a hard time finding it. I would appreciate any help.

Basically I need to setup an API call with ember data, and instead of it pulling from a url, I would like for it to pull from a json file locally (static data).

My thoughts are if I set the namespace in the adapter it should work but it didn’t.

If you want to use Ember Data to retrieve json and have it end up in the store, then you’ll want to setup a custom adapter to point to the right URL (more info here: Customizing Adapters - Models - Ember Guides ). You may just want to setup findAll: Adapter - 4.6 - Ember API Documentation

If you don’t want this data in the Ember Data store then I’d suggest doing a simple Ajax call :smiley:

You can’t access a local file from your browser unless you use something like ember-electron. But you can still use the old fixture-adapter or put your local static data somewhere your browser can access it via an URL.