UNPKG

415 BJavaScriptView Raw
1const CONSTANTS = require('@src/utils/constants');
2
3module.exports = {
4 toString
5};
6
7/**
8 * Convert JSON object to display string
9 * @param {Object} jsonObject
10 * @returns formatted JSON string or serialization error
11 */
12function toString(jsonObject) {
13 try {
14 return JSON.stringify(jsonObject, null, CONSTANTS.CONFIGURATION.JSON_DISPLAY_INDENT);
15 } catch (e) {
16 return e.toString();
17 }
18}