OpenDataServices / flatten-tool

Tools for generating CSV and other flat versions of the structured data
http://flatten-tool.readthedocs.io/en/latest/
MIT License
105 stars 15 forks source link

Currently no support for using a separate sheet for simple arrays #26

Open Bjwebb opened 10 years ago

Bjwebb commented 10 years ago

This may be desirable if the array/items are long, or one of the items contains a ; or , character.

(Split out from https://github.com/open-contracting/flattening-ocds/issues/1)

Bjwebb commented 8 years ago

TODO: Check whether this is possible with our new JSON pointer style

jpmckinney commented 6 years ago

Do I understand correctly? e.g.:

Input:

{
  "main": [
    {
      "a": [1, 2, 3]
    }
  ]
}

Current output:

main.csv:

a
1;2;3

Desired output (with appropriate configuration):

main.csv:

id
1

a.csv

id,a/0
1,1
1,2
1,3

And/or:

main.csv:

id,a/0,a/1,a/2
1,1,2,3

Note: Running unflatten with the above produces:

{
    "main": [
        {
            "id": "1",
            "a": []
        }
    ]
}