This is currently undocumented, but I’ll add documentation for it for the next release. Thanks for bringing that back to our attention.
Basically, we support having any particular entry in a TSV file be a JSON object, so long as you specify that in the types argument. So if you have a file like:
Thanks for the info. I was able to get the import to work on a mininal example. Setting up the types string will be a bear for the full annotation, but it is good to know this is possible.
For my use case, the json file doesn’t have an ID or json_field row and starts directly with the data.
{"foo": "bar", "x": 7, "input", "some long string"}
{"foo": "b3", "x": 100, "input", "some other long string}
To import the json file:
types = {'f0':hl.tstruct(foo=hl.tstr, x = hl.tint32, input = hl.tstr)}
ht = hl.import_table('json_file.tsv', types = types, header = False)
# Import sets f0 as a top level field. Make the contents of f0 top level instead.
ht2 = ht.f0
# Drop some columns I don't need
ht3 = ht.drop('input')
Some questions:
Is there another way to set the columns as “top-level”?