Working with JSON and Arrays
Hello,
I've been working with JSON as inputs to services a lot more lately and I've noticed a strange behavior, at least for me.
When I have set the Inputs as a JSON:

And put a JSON object with an array in it (with several objects in it), something like this:

When using this object in the code and trying to push some new objects into this array I get the error saying that the .push() function doesn't exist.
"TypeError: Cannot find function push in object"
But if I declare the exact same object in the code, something like this:
let array = {
"PlatformData": [
{
"Comment": "User Projects (not the PTC projects)",
"Description": "1\nP",
"Instance": "",
"ServerName": "",
"TypeOfEntity": "Projects",
"Timestamp": "2022-11-04 15:52:37.170",
"Name": ""
},
{
"Comment": "User Projects (not the PTC projects)",
"Description": "",
"Instance": "",
"ServerName": "",
"TypeOfEntity": "Projects",
"Timestamp": "2022-11-04 15:52:37.170",
"Name": ""
}
]
};
let newObject = {
"Comment": "User Projects (not the PTC projects)",
"Description": "",
"Instance": "",
"ServerName": "",
"TypeOfEntity": "Projects",
"Timestamp": "2022-11-04 15:52:37.170",
"Name": ""
};
// local variable which works:
array.PlatformData.push(newObject);
// Service variable which doesn't work:
Input.PlatformData.push(newObject);It is entirely possible that I just don't know enough about these different types. But to me it doesn't make much sense why one works while the other doesnt.
Any help with this would be much appreciated.
Thanks.

