• I am attempting to ‘post’ JSON using this, but nothing is appearing on the destination page. Can you let me know what I am missing? Thx.

    function makeJSON_(object, options) {
      if (options.format == FORMAT_PRETTY) {
        var jsonString = JSON.stringify(object, null, 4);
      } else if (options.format == FORMAT_MULTILINE) {
        var jsonString = Utilities.jsonStringify(object);
        jsonString = jsonString.replace(/},/gi, '},\n');
        jsonString = prettyJSON.replace(/":\[{"/gi, '":\n[{"');
        jsonString = prettyJSON.replace(/}\],/gi, '}],\n');
      } else {
        var jsonString = Utilities.jsonStringify(object);
      }
      if (options.language == LANGUAGE_PYTHON) {
        // add unicode markers
        jsonString = jsonString.replace(/"([a-zA-Z]*)":\s+"/gi, '"$1": u"');
      }
      return jsonString;
    }
    
    var JSON_DESTINATION_URL = 'https://rpssolar.com/?page_id=1822';
    
    function sendJson_(json) {
       var options =   {
         "contentType":"application/json",
         "method" : "post",
         "payload" : json
       };
  • The topic ‘Accepting JSON post’ is closed to new replies.