Want to replace Json file content from octopus variable

Hi Team,

I am working on one Json file. But I want particular node content configurable from octopus variable.
for eg:-
{
“FileName”: “report File”,
“Dept”: {
“Address”: “New York”,
“Members”: “50”
}
}

So I want this all content to come from octopus variable. Can any one please guide on this.

Hi @timocfc1991,

Thanks for getting in touch!

We have a guide that covers the best ways of replacing values in JSON files with variables here: https://octopus.com/docs/deployment-process/configuration-features/json-configuration-variables-feature

If you run into any problems with this, please let me know.

Best regards,
Paul

Hi Paul,

Thanks for the revert!

Here with the help of json variable i am able to replace particular “value” from json key-value pair.

But i want to replace all the key-value pair with one octopus variable only.

eg:-
file name :- abc.json

{
“key1”:“value1”,
“key2”:“value2”,
“key3”:“value3”
}

this whole content of abc.json I want to replace with octopus variable.

Hi @timocfc1991,

The only way to do this would be to add a variable for each value that you wish to change.
e.g.
In your Variables you would have the following:

Regards,
Paul

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.