Skip to content

[FEATURE] Add JSON Datasource and Json Query plugin - #770

Open
adrianSepiol wants to merge 6 commits into
perses:mainfrom
adrianSepiol:feature/json-datasource-plugin
Open

adrianSepiol wants to merge 6 commits into
perses:mainfrom
adrianSepiol:feature/json-datasource-plugin

Conversation

@adrianSepiol

Copy link
Copy Markdown
Contributor

Related issue: perses/perses#3284
Depends on:

Description

Adds json datasource and query plugin. It allows to query any endpoint that returns json and optionally parse output with jsonata. This MVP allows for:

  • querying data with GET
  • querying data with post with json body
  • adding query params
  • using variables in path, body and request params
  • using result with Table plugin

Limitations:

  • using variables in jsonata expression is not allowed as it conflicts with its syntax
  • only json body is allowed for post call

Screenshots

Datasource editor:

Screenshot 2026-08-17 at 12 03 37

Query plugin for GET:

Screenshot 2026-08-17 at 12 06 09

Query Plugin for POST:
Screenshot 2026-08-17 at 12 09 04

Query with request params:
Screenshot 2026-08-17 at 12 26 06

Query with body:
Screenshot 2026-08-17 at 12 28 35

Error for empty response:

Screenshot 2026-08-17 at 12 31 41

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.

@adrianSepiol
adrianSepiol force-pushed the feature/json-datasource-plugin branch 5 times, most recently from db4e2ff to c31bb11 Compare September 1, 2026 11:43
@adrianSepiol
adrianSepiol marked this pull request as ready for review September 1, 2026 13:12
@adrianSepiol
adrianSepiol requested review from jgbernalp and removed request for a team September 1, 2026 13:12
@adrianSepiol
adrianSepiol force-pushed the feature/json-datasource-plugin branch from c31bb11 to 1f946ba Compare September 15, 2026 11:03

export function buildJsonTableData(queryResults: Array<PanelData<JsonData>>): Array<Record<string, unknown>> {
return queryResults.flatMap((r: PanelData<JsonData>) => {
return toItemArray(r.data).map(({ data }) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When creating a table panel with a datasource that does not return anything yet (testing). I get an error as it cannot destructure data:

Cannot destructure property 'data' of 'param' as it is undefined.
Image

Comment thread table/src/table-data-utils.ts Outdated

function toItemArray<T>(data: T): T[] {
if (Array.isArray(data)) return data;
if (data !== null) return [data];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (data !== null) return [data];
if (data !== null && data !== undefined) return [data];

@adrianSepiol
adrianSepiol force-pushed the feature/json-datasource-plugin branch 2 times, most recently from 20eef75 to 1baf8d9 Compare September 16, 2026 11:30

@jgbernalp jgbernalp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

Comment thread json/src/queries/json-query/get-json-data.ts Outdated
Comment thread json/src/datasources/json-datasource/json-datasource-utils.ts Outdated
Comment thread json/src/queries/json-query/JsonQueryEditor.tsx
Signed-off-by: Adrian Sepiół <a.sepiol@sap.com>
Signed-off-by: Adrian Sepiół <a.sepiol@sap.com>
Signed-off-by: Adrian Sepiół <a.sepiol@sap.com>
Signed-off-by: Adrian Sepiół <a.sepiol@sap.com>
Signed-off-by: Adrian Sepiół <a.sepiol@sap.com>
@adrianSepiol
adrianSepiol force-pushed the feature/json-datasource-plugin branch from 1baf8d9 to 2451fba Compare September 17, 2026 10:31
Signed-off-by: Adrian Sepiół <a.sepiol@sap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants