Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Tabular field to structure #212

Open
ramfox opened this issue Oct 11, 2019 · 0 comments
Open

feat: add Tabular field to structure #212

ramfox opened this issue Oct 11, 2019 · 0 comments

Comments

@ramfox
Copy link
Member

ramfox commented Oct 11, 2019

CSV and xlsx are always considered Tabular.

Json is where this get's more fun. Tabular is true when each entry in the data, whether or not the top level is object or array, has the same schema.

Tabular:
[[1,2,3],
 [4,5,6],
 [7,8,9]]

[
 {
   "title":"foo",
   "count":3,
},
 {
   "title":"bar",
   "count":2,
},
]

{
  "first": ["foo", 3],
  "second: ["bar", 2]
}

{
  "first": {
    "title":"foo",
    "count":3
    },
  "second": {
    "title":"bar",
    "count":2
}

This data can be displayed tabularly:

row title count
first foo 3
second bar 2
{
  "first": {
    "name":"foo",
    "coor": {
        "x": 20,
        "y": 18
     },
    },
  "second": {
    "name":"bar",
    "coor": {
        "x": 100,
        "y": 8
     },
}

This data can be displayed tabularly:

entry name coor.x coor.y
first foo 20 18
second bar 100 8

However, until we get good schema detection of objects, we cannot know if for certain if json can be displayed as Tabular

To catch the most used "shapes" of JSON data, however, we can check if the second level of encapsulation for each entry is an array. If they are each an array, we can display the JSON as a table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant