HEX
Server: nginx/1.24.0
System: Linux nowruzgan 6.8.0-57-generic #59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025 x86_64
User: babak (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/dev/nowruzgan/rest/node_modules/machinepack-json/machines/stringify.js
module.exports = {


  friendlyName: 'Stringify as JSON',


  description: 'Encode the specified value into a JSON string.',


  sync: true,


  cacheable: true,


  inputs: {

    value: {
      friendlyName: 'Data',
      description: 'The data to encode as a JSON string',
      example: '*',
      required: true
    }

  },


  exits: {

    couldNotStringify: {
      friendlyName: 'could not stringify',
      description: 'Could not stringify provided value into a JSON string.',
      extendedDescription: 'Oftentimes this error results from attempting to stringify a circular object (i.e. has a key or array item which points back to the parent object).  Refer to the official JSON specification at http://www.json.org/ for more information.'
    },

    success: {
      friendlyName: 'then',
      description: 'Done.',
      example: '...{"some stringified json": "like this"}...'
    }

  },


  fn: function(inputs, exits) {
    var jsonString;
    try {
      jsonString = JSON.stringify(inputs.value);
    }
    catch (e){
      return exits.couldNotStringify(e);
    }
    return exits.success(jsonString);
  }

};