Article - CS284117

Error when pushing to JSON in ThingWorx Service

Modified: 28-Jul-2023   


Applies To

  • ThingWorx Platform 6.6 F000 to 9.5

Description

  • Authoring ThingWorx JavaScript Service
    • Attempting to add an empty array into a JSON object
var myJSON = new Object();
myJSON = {
	"key":"value"
};

var myArray = [];
myJSON.push(myArray);
  • Receive the following error:
TypeError: Cannot find function push in object [object Object].

 
This is a printer-friendly version of Article 284117 and may be out of date. For the latest version click CS284117