2

I'm not sure if this is possible as I've searched but couldn't find anything related, but didn't find anything saying it's not!

In my Azure DevOps build pipeline I have a variable which holds a JSON value e.g:

enter image description here

Is there anyway of using a value of a json variable within a task? I've tried (on the off chance) $(myJson.message) and $(myJson).message but these didn't work.

So do pipeline variables only support simple types? Or is there a way round this?

3
  • I don't think it's possible. Commented Jan 31, 2019 at 13:11
  • Do you mean get a task to transform a file that contains a json variable? Also, what's the task you're using and what's the goal? Commented Jan 31, 2019 at 16:01
  • 1
    Have you considered already using a powershell task to parse the variable and using a command to set a variable for use later in the pipeline? Commented Jan 31, 2019 at 20:09

1 Answer 1

1

You could always use something like powershell's Convert-FromJson to create a json object, but there's no way to tell a random task "treat this variable value as an object, rather than a raw string". You'll have to parse it yourself.

Sign up to request clarification or add additional context in comments.

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.