Module: json-controller

Controller functions for json files reading and writing
Version:
  • 0.0.2
Author:
  • Danilo Del Busso

Methods


<inner> getJSON(path)

Returns the content of the JSON file
Parameters:
Name Type Description
path string The absolute path of the config file
Returns:
The config in JSON format, null if the file doesn't exist or is not a properly formatted JSON object
Type
json
Example

Example usage of getJSON.

getJSON(__dirname + '/config.json')

<inner> isJSON(data)

Check if the data is a properly formatted JSON file
Parameters:
Name Type Description
data string
Returns:
null if the data was not a properly formatted JSON object, the data in JSON if otherwise
Type
JSON