Variable Numeric Strings Replacement

Hi,

Can someone help me around a variable replacement we are performing on our json configuration files.

The value is a numeric string and includes a proceeding zero. Ie. 0123.

The problem is that the substitution converts is as a number, ie. 123. If we add quotes, then octopus escapes the string and we end up with "“0123"”. I found some information around JsonEscape, but we are unable to get it to work without it just outputting the entire string.

If anyone can point us in the right direction I’s appreciate it, as it seems quite a simple task.

Hi Tom,

Thanks for reaching out. Unfortunately numbers with proceeding 0’s arent a supported value in the JSON spec, because of this any proceeding 0’s are dropped when we do the variable replacement. One option you could try is instead of using the JSON configuration variables feature on the deployment step, you could try using the Substitute Variables in Files feature, this will allow you to insert any value in json file with what ever value you define in the variable. It is however slightly different in how you define the variables in the file, and you would need to modify the json file to include the variable syntax, there is some documentation here to explain how it works.

I hope that helps, please let me know if you have any further questions.

Kind Regards,
Tom W

Hi Tom,

I just wanted to reach out and see if you managed to find a solution to the variable substitution issue?
Please let me know if I can help any further.

Kind Regards,
Tom W

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