csvtojson

Convert CSV to a nested JSON while formatting values for specific keys to numeric/int/float

梦想与她 提交于 2019-12-24 03:48:34
问题 I am trying to convert a CSV file to nested JSON, here's my CSV with first row as columns. CLID,District, attribute,value C001,Tebuslik, Name,Philip C001,Tebuslik,Age,34 C002,Hontenlo,Name,Jane C002,Hontenlo,Age,23 My desired output is a nested json where the values of the Age key are numeric and not strings. [ { "CLID": "C001", "District": "Tebuslik", "attributes": [ { "attribute": "Name", "value": "Philip" }, { "attribute": "Age", "value": 34 } ] }, { "CLID": "C002", "District": "Hontenlo",