bool JSONSerializable::loadJSON(string path){
	bool success = true;
	std::fstream fs;
	fs.open (path, std::fstream::in );
	
	json j;
	j<<fs;
	success &=!j.is_null();
	success&=getJSONData(j);
	return success;
}
Result Engine::saveDocument (const File& file){

  var data = getJSONData();

  if (file.exists()) file.deleteFile();
  ScopedPointer<OutputStream> os( file.createOutputStream());
  JSON::writeToStream(*os, data);
  os->flush();

  setLastDocumentOpened(file);
  return Result::ok();
}