JSON Parameter

A Jenkins plugin that allows parameters to be populated dynamically using JSON data from configurable sources.

Build
Contributors
Jenkins Plugin Installs
Plugin
GitHub release


🚀 Introduction

This plugin defines a new parameter type: JSON Parameter.
It allows Jenkins jobs to dynamically fetch, parse, and populate values from JSON sources at runtime or configuration time.

Supported JSON sources:

  • ✅ Jenkins Config File Provider (folder-based or global)
  • Remote HTTP endpoints

You can extract values using JSONPath syntax, making it easy to map dynamic structures into usable parameter options.


⚙️ Getting Started

1. Install the plugin

Install via Jenkins Plugin Manager:
Manage Jenkins » Manage Jenkins » Available plugins » JSON Parameter

Requires:

2. Add a JSON Parameter

When configuring a job:

  1. Click "Add Parameter""JSON Parameter"
  2. Fill in the following fields:
    • Name: Internal parameter identifier
    • Description (optional)
    • Default Value (optional)
    • Query: JSONPath expression (e.g., $[*].name)

3. Select a JSON Source

🔹 Config File

  • Choose between:
    • Folder-level config (via Folder Config File Property)
    • Global config
  • Provide the Config File ID
  • If using folder-level config, also provide the Folder Path

🔹 Remote HTTP Endpoint

  • Enter a full API URL that returns JSON
  • Select Credentials ID if required

4. Examples

📦 Sample JSON

[
  { "name": "Alpha" },
  { "name": "Beta" }
]

🔧 Example 1: Folder-level config with placeholder

parameters {
  jsonParam(
          name: 'JSON_PARAM', 
          description: 'List data from JSON source.', 
          defaultValue: '', 
          query: '$[*].name', 
          source: [$class: 'ConfigFileSource', configId: 'my-id', folderPath: 'FolderA', folderScoped: true]
  )
}

➡️ Rendered dropdown:

["-- Choose an option --", "Alpha", "Beta"]

🔧 Example 2: Global config with preselected default

parameters {
  jsonParam(
          name: 'JSON_PARAM', 
          description: 'List data from JSON source.', 
          defaultValue: 'Alpha', 
          query: '$[*].name', 
          source: [$class: 'ConfigFileSource', configId: 'my-id', folderPath: '', folderScoped: false]
  )
}

➡️ Rendered dropdown:

["Alpha", "Beta"]

🔧 Example 3: HTTP JSON source

parameters {
  jsonParam(
          name: 'JSON_PARAM', 
          description: 'List data from JSON source.', 
          defaultValue: 'Beta', 
          query: '$[*].name',
          source: [$class: 'RemoteSource', credentialsId: 'my-id', url: 'https://dummyjson.com/api/data']
  )
}

➡️ Rendered dropdown:

["Beta", "Alpha"]

💡 You can also generate the DSL snippet via the Pipeline Syntax Generator in Jenkins.


Contributing

Refer to our contribution guidelines

LICENSE

Licensed under MIT, see LICENSE