index.js
function valid() {
    var fName = ''
    if (arguments.length == 2) {
        // Given the database name and location
        const dbName = arguments[0]
        const dbLocation = arguments[1]
        var fName = path.join(dbLocation, dbName + '.json')
    } else if (arguments.length == 1) {
        const dbName = arguments[0]
        fname = path.join(userData, dbName + '.json')
    }

    const content = fs.readFileSync(fName, 'utf-8')
    try {
        JSON.parse(content)
    } catch (e) {
        return false
    }
    return true
}
function valid() {
    var fName = ''
    if (arguments.length == 2) {
        // Given the database name and location
        const dbName = arguments[0]
        const dbLocation = arguments[1]
        var fName = path.join(dbLocation, dbName + '.json')
    } else if (arguments.length == 1) {
        const dbName = arguments[0]
        fname = path.join(userData, dbName + '.json')
    }

    const content = fs.readFileSync(fName, 'utf-8')
    try {
        JSON.parse(content)
    } catch (e) {
        return false
    }
    return true
}
Checks if a json file contains valid JSON string