1

I have a JSON file and I can change the value of "src" and "composition" but I can not change the value of actions/postrender/second output value.

I am using this js

file.template.src = "value1";
file.template.composition= "value2";
file.actions.postrender.output= "value3";
{
    "template": {
        "src": "value1",
        "composition": "value2"
    },
    "actions": {
        "postrender": [
            {
                "module": "@nexrender/action-encode",
                "preset": "mp4",
                "output": "encoded.mp4"
            },
            {
                "module": "@nexrender/action-copy",
                "input": "encoded.mp4",
                "output": "d:/mydocuments/results/myresult.mp4"
            }
        ]
    }
}
1
  • That is because postrender is not an ''object'', but rather an array - Yes, in JS everything is an object, but in this context it doesn't make sense to call the array an object. Commented Aug 12, 2022 at 17:26

3 Answers 3

1

file.actions.postrender.output= "value3"; Doesn't work because postrender is an array.

You need to specify which element you want to modify (0 for the first element, or 1 for the second element):

file.actions.postrender[0].output= "value3";
file.actions.postrender[1].output= "value3";
Sign up to request clarification or add additional context in comments.

Comments

1

Thats because you are not selecting the second element in the array. Use the index operator to first get the second element and then modify the value:

file.actions.postrender[1].output= "value3";

Comments

1

It is because te value of the key "postrender" is an array.

To update the key "output" of an element of the array you should select which element, for example:

file.actions.postrender[0].output= "value3";

If you want to update all of the elements you could use a for loop.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.