Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

How to store array in capabilities.json object?

Hi,

I want to store some values as an array in the capabilitis.json object, The initial value will be null, as based on user interaction I'm updating property value using persistProperties. 

Currently, I declare object type as text, and store array values by converting them to comma-separated values (eg; "val1, val2, val3"). But is there any better way to store array value in settings?

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @Anonymous,

There's no support for complex types as property values. Most developers will use text as the data type (as you're already doing), hide the property during enumeration and JSON.stringify the array before it's persisted. Use JSON.parse when you read it back.

You may be better with the property default as "[]" so that an 'empty' property will parse to an empty array and be ready to work with in your code (or you could coalesce a default null property value to an empty array).

Regards,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @dm-p,

Thanks for the solution, I also tried diffrent approaches but ended up using the way you suggested.

dm-p
Super User
Super User

Hi @Anonymous,

There's no support for complex types as property values. Most developers will use text as the data type (as you're already doing), hide the property during enumeration and JSON.stringify the array before it's persisted. Use JSON.parse when you read it back.

You may be better with the property default as "[]" so that an 'empty' property will parse to an empty array and be ready to work with in your code (or you could coalesce a default null property value to an empty array).

Regards,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.