Forum Discussion

ramansingh89's avatar
11-15-2024
Solved

Expose JSON Key in a widget

Hi All,

I am trying to understand if there is any way to extract json "keys" as columns in a Sisense widget. 

Example: Lets say we have a semi-structure table that contains some json attributes which is some key:value pairs 

attributes:{ "x1": "John Doe", "x2": 30, "x3": 180 }

is there a way I use "x2" in my widgets (eg: line chart) without me creating/hard-code into columns on the database/model level?

 
  • Hey ramansingh89 ,

    On a dashboard level it might be possible using the Custom Code Transformation Feature.
    the Transformation can be done on a widget level.

    However, it's more common to normalized the data directly in the Data Source to reduce the Computation on the Users level and provide more flexibility.
    For Elasticubes, Custom Code Feature provide the ability to retrieve the Json Data and Transform it to a Data Frame, which is then returned as a table within the data model with normalized data.
    Transforming the data directly in the data model simplifies drag-and-drop operations, enhances filtering capabilities, and allows for more advanced data manipulations.

    Both Features are based on Python Jupyter Notebooks.

    Best Regards

    fyi DRay 

2 Replies

  • AssafHanina's avatar
    AssafHanina
    Sisense Employee

    Hey ramansingh89 ,

    On a dashboard level it might be possible using the Custom Code Transformation Feature.
    the Transformation can be done on a widget level.

    However, it's more common to normalized the data directly in the Data Source to reduce the Computation on the Users level and provide more flexibility.
    For Elasticubes, Custom Code Feature provide the ability to retrieve the Json Data and Transform it to a Data Frame, which is then returned as a table within the data model with normalized data.
    Transforming the data directly in the data model simplifies drag-and-drop operations, enhances filtering capabilities, and allows for more advanced data manipulations.

    Both Features are based on Python Jupyter Notebooks.

    Best Regards

    fyi DRay 

  • Hi ramansingh89,

    Thank you for reaching out. I'm working to get you an answer, but we need some additional details. What do you want in X-axis and values of the widget?