CSV Data Source - keywords to get JSON to use in Server Side JS


(Lisa) #1

Hi, I have CSV data in a CSV Data Source. In the “View Records” screen of that asset I can see a JSON version of the data. Are there any keywords we can use to access that JSON with Server Side JS?

I know an option is to create a REST resource to output the JSON directly from a CSV File asset, as outlined in this forum post: How to convert uploaded CSV to JSON on the server
However that CSV parsing is fairly simplified and doesn’t take into account quoted strings containing commas, new lines, etc. I could add a bunch of complicated code to enhance the parsing, but why re-invent the wheel when the Matrix CSV Data Source has already converted it to JSON as displayed in the “View Records” screen…

(And no, I can’t just use asset listings on the CSV Data Source since we need more flexibility with filtering and search than the combination of asset listing and data filters can provide. I specifically want JSON to use in Server Side JS.)

Matrix v5.5.1.5