Skip to content

CSV Decode

The csv::decode function parses a CSV string and converts it into a list of maps, where each map represents a row of the CSV.

Syntax

csv::decode(<csv-string>)

Parameters

  • csv-string: The input CSV string to decode. The first row is treated as the header.

Returns

  • List of Maps: A list where each map corresponds to a row, with keys derived from the header row.

Example

Try it out below!
csv::decode("name,age\nAlice,30\nBob,25")

This function is useful for parsing CSV data into a structured format for testing or validation.