Reformat · Hard

CSV to JSON

A small table arrives as CSV: the first line is the header.

Task

Write a prompt that turns it into a JSON array of objects.

Output format

[{"col":value,...},...] on one line, no spaces

  • Use the header names as keys, in the same order.
  • Whole numbers become numbers (no quotes); everything else is text.
  • No spaces, no line breaks, no ``` code block.

Your prompt must contain {input}: it is replaced by each test case, just like the hidden tests in a hiring test.

Sample case 1
Input
name,age
Ali,30
Maya,25
Output
[{"name":"Ali","age":30},{"name":"Maya","age":25}]
Sample case 2
Input
city,code
Paris,75
Oslo,0150
Output
[{"city":"Paris","code":75},{"city":"Oslo","code":150}]

There are 4 test cases in all; the others are like hidden tests: work out what tricky inputs they might use!

Loading the editor…