Config variables replacement fails with json --> unexpected char

(Alex) #1

Hello,

I have .json which looks like this:
“Serilog”: {
“Using”: [ “Serilog.Sinks.EventLog”, “Serilog.Settings.Configuration” ],
“Filter”: [

Currently when I try to replace the “Serilog:Using” I have this configuration:

Questions:

  1. How to get across this Error: Unable to set value for Serilog:Using. The following error occurred: Unexpected character encountered while parsing value: S. Path ‘’, line 0, position 0.
  2. How what will happen with the other Values like “Serilog.Sinks.EventLog” --> how can I delete this Value?

Regards
Alex

(David Young) #5

Hi Alex. Thanks for getting in touch!

You already have the right approach here to remove the Serilog.Sinks.EventLog value, because Octopus will replace the entire value of Using with the variable.

The error is occurring because the variable’s value is interpreted as a literal JSON value, so it’s trying to build this, which wouldn’t be valid JSON:

ScreenClip

To match the existing format of that value (an array containing strings), add the JSON delimiters to your variable’s value, like this:

["Serilog.Settings.Configuration"]

I hope that helps. Please let us know if there are any more problems.

Regards,
David