src/lib/http/HttpPayload.js
/**
   * Generates random JSON data.
   * @return {string} JSON payload
   */
Generates random JSON data.
@return {string} JSON payload
Generates random JSON data . @return { string } JSON payload
json() {
    const size = this[typesValue].number({ min: 1, max: 10 });
    let result = '{';
    let addComa = false;
    for (let i = 0; i < size; i++) {
      const name = this[loremValue].word();
      const value = this[loremValue].paragraph();
      if (addComa) {
        result += ',';
      } else {
        addComa = true;
      }
      result += '\n\t';
      result += `"${name}":"${value}"`;
    }
    result += '\n';
    result += '}';
    return result;
  }
json ( ) { const size = this [ typesValue ] . number ( { min : 1 , max : 10 } ) ; let result = '{' ; let addComa = false ; for ( let i = 0 ; i < size ; i ++ ) { const name = this [ loremValue ] . word ( ) ; const value = this [ loremValue ] . paragraph ( ) ; if ( addComa ) { result += ',' ; } else { addComa = true ; } result += '\n\t' ; result += ` ${ name } ${ value } ` ; } result += '\n' ; result += '}' ; return result ; }
Generates random JSON data.
Generates random JSON data .