I have been working on a node module for quite some time now and realized that if I wanted a synchronous and asynchronous function, I would have to make a different way to call the function.

Right before I call the callback function, if I console.log it, it works fine and outputs as an object. Logging the typeof also says that it is an object. However, as soon as it gets to the other side, to the test.js file, It always outputs as 

> 
> [object Object]
> 
> 
> 

If I log the typeof, it says that it is an object. If I attempt to log any value of it, it won't work. An array of two objects outputs like this

> 
> [object Object],[object Object]
> 
> 
> 

It works correctly if I use JSON.stringify(), but I would like to output it as parsed. 

Note: I am still able to access the values in the file.

CODE:

test.js (My test file)

```
var val;
instances.findInstance(config, function(err, res){
 if (err){
   arkin.error(err);
 }
 val = res;
});

console.log('\n\nOUT\n' + val.failures[0].failure);

```

index.js (The file which the functions will be in)

```
module.exports.findInstance = async function(config, callback){
  var returned = instances.find(config);

  const errorJson = JSON.parse(fs.readFileSync(__dirname + '/error.json', 'utf8'));

  end(); //Deletes the JSON files

  if (globalError === true){
    let err = new Error(JSON.stringify(errorJson));
    if (!err){
      err = 'An unknown error occured';
    }
    returned = undefined;
    callback(err, returned);
  }else{
    let err = undefined;
    callback(err, returned);
  }
}

```

main.js (Previous index.js. Snippet that handles the returns)

```
  //RESULTS
  let result = JSON.parse(fs.readFileSync('./results.json', 'utf8'));

  if (globalError === true){
    return 'ERROR';
  }else{
    return result;
  }

```

Thanks for your help!