Parse Yaml document from File, Raw Text or an Variable.
Parse Json document from File, Raw Text or an Variable.
Parse Xml document from File, Raw Text or an Variable.
Query across documents and fields using jsonpath-plus.
Extract values from multiple queries to File, echo or Variable.
Pipe based utility functions (only downcase and uppercase until now).
You can test our jsonpath expressions here, but first you must convert your yaml-to-json.
Basic queries syntax
# Extract results to variablesvar NAME =.metadata.name| downcase
var KIND =.kind# Just print resultsecho.kind# Extract results to JSON filefile./bar/annotations.json=.metadata.annotations
Usage sample
- job:
...
steps:
- task: YamlParseFromVivo@4
displayName: "Extract catalog-info.yaml info"
inputs:
source: catalog-info.yaml
sourceType: file
queries: |
# Extract results to variables
var NAME = .metadata.name | downcase
var KIND = .kind
# Just print results
echo .kind
# Extract results to JSON file
file ./foo/bar.json = .metadata.annotations
- task: XmlParseFromVivo@4
displayName: Extract pom.xml info
inputs:
sourceType: 'file'
source: 'pom.xml'
queries: |
var VERSION = .project.version._text
var ARTIFACT_ID = .project.artifactId._text
var GROUP_ID = .project.groupId._text
var PACKAGING = .project.packaging._text
- task: JsonParseFromVivo@4
displayName: Extract package.json info
inputs:
sourceType: 'file'
source: 'package.json'
queries: |
var NAME = .name
var VERSION = .version