so I am trying to write a yaml for an ADO pipeline which therefore uses ADO syntax. But somehow within the process some " get lost and I don't know why. So here's my yaml file:
parameters:
- name: dictionary
type: string
default: '{\"PartitionKey\": \"test\", \"RowKey\":\"test1\"}'
steps:
- script: |
echo ${{ parameters.dictionary }}
- task: PythonScript@0
inputs:
scriptSource: 'filePath'
scriptPath: path/table.py
arguments: --output_parameters ${{ parameters.dictionary }}
The output of echo ${{ parameters.dictionary }}
is {"PartitionKey": "test", "RowKey":"test1"}
Within my python script the output of
print(args.output_parameters)
is
{\PartitionKey": "test", "RowKey":"test1"}
and the error message is the following because I try to gain a dictionary (my_entity= json.loads(args.output_parameters)
):
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
So why is there a \ instead of a " in front of the first key "PartitionKey" even though it seemed to work fine for all other key value pairs?