Local JSON file

I tried this method which was on fuse offical document. But it doesn’t work

  var Bundle = require("FuseJS/Bundle");

  Bundle.read("someData.json")
      .then(function(contents) {
          console.log(contents);
      }, function(error) {
          console.log("Error!", error);
      });

SomeData.json file

  [{
    "list": [
      {
        "Director": "Theresa Carr",
        "Manager": "Peter Morales",
        "Manager1": "Jeffrey Martin",
        "Developer": "Melissa Jackson",
        "Publicrelation": "Robert Cunningham",
        "CommunityManager": "Kelly Rogers"
      }
    ]
  }]

it runs on fuse console but there is no output. What I did wrong? any help

Did you actually Bundle your file in your unoproj file? https://www.fusetools.com/docs/fusejs/bundle

{
    "Includes": [
        "<filename>:Bundle"
    ]
}

yup

Make sure to close every fuse instance running and always call uno clean after changing your unoproj file. Oh and I’m not sure if the naming is case sensitive that could be it. In your JS you did someData.json not sure if that’s the same case as the actual file name, also try absolute path names.

Like me I have my json in my Assets folder so:

Bundle.read('Assets/SomeData.json')

This forum post should help my last post: https://www.fusetools.com/community/forums/permalink/7ceb9aea-4b3c-463b-a1f1-9bb5a5e1778b

Edwin Reynoso wrote:

Make sure to close every fuse instance running and always call uno clean after changing your unoproj file. Oh and I’m not sure if the naming is case sensitive that could be it. In your JS you did someData.json not sure if that’s the same case as the actual file name, also try absolute path names.

Like me I have my json in my Assets folder so:

Bundle.read('Assets/SomeData.json')

This forum post should help my last post: https://www.fusetools.com/community/forums/permalink/7ceb9aea-4b3c-463b-a1f1-9bb5a5e1778b

Tried the link you provided but still no output. But I keep getting ‘LOG:’ on fuse console.

How are you getting Log: if you didn’t show that in your code, did you change your code?

I didn’t change anything I just wrote console.log(people); The output was

        Log:

Hi,

Bundle.read returns a promise, see here for example: https://www.fusetools.com/docs/fusejs/bundle/readasync_95a738ba

There is also a sync version:

https://www.fusetools.com/docs/fusejs/bundle/read_bbef95e2

it’s not reading either. Would be good if working example is provided. If I use Bundle.read(filename). The output is

    Log:null

The example for read works for me, exactly as provided in the docs.

Are you sure you have inlcuded your JSON file in the bundle?

Are you sure you understand that read is an async method that returns a promise, and does not return the string?

Ah! the new fresh build works. Have to delete old build and start new build. One question, is fuse planning to use external database like pouchDB, lokijs db or any db?

pouchDB

https://pouchdb.com/

lokijs db:

http://lokijs.org/#/

If you are looking after a local DB solution, that is something we really want to do at some point. But there is already one solution created by the community https://github.com/bolav/fuse-sqlite