0

I'm trying to convert a CSV (or XLS) file into JSON. I've come across a number of closed/resolved posts about this, but I am yet to find a solution to what I'm specifically trying to do - which is as follows.

If a column is called 'Colour' then I want to export a single JSON property, but if the column is called 'Features_Count' then I want to create a 'Features' property that is an object instead of a string, and that object contains a property called 'Count'. In other words, I want to be able to have nested properties. The JSON should therefore look something like this:

[
  {
    "id": 1,
    "colour": "blue",
    "features":{
      "count": 1
    }
  }
  {
    "id": 2,
    "colour": "red",
    "features":null
  }
]

Does anyone have any ideas how this can be done? Please do bear in mind I'm pretty much a beginner when it comes to this...

Nat Aes
  • 887
  • 5
  • 18
  • 34
  • What do you mean by `CSV database`? What the language or framework can you use? What you found so far? What have you tried? Your question is to broad right now. – Michał Ziober Mar 07 '19 at 21:30
  • @MichałZiober - it's just a regular CSV file, and I'm comfortable using VBA. The solutions I've come across are either online translators, or requite runtime coding (which I'm not too comfortable with). – Nat Aes Mar 08 '19 at 11:06
  • See [Convert Json to csv and csv to Json in Excel VBA](https://codingislove.com/json-csv/) and [converting CSV/XLS to JSON?](https://stackoverflow.com/questions/662859/converting-csv-xls-to-json) – Michał Ziober Mar 08 '19 at 11:27

0 Answers0