data-curator icon indicating copy to clipboard operation
data-curator copied to clipboard

Order of JSON file is not intuitive/simple

Open louisjasek opened this issue 6 years ago • 3 comments

Current Behaviour (for problems)

When I export a data package, the content of the datapackage.json is in an order that is not intuitive/simple. I would expect the order of the content to start with the package information, then table, Instead it seems to start with the table information, then package. What's more, the information inside each of the package/table content is not necessarily in the right order. For example, one data package I exported has the package license information before the package name. I'm not sure if this is because it prints the content of the JSON in the order of user input or if it is set this way.

While this is fine as a machine-readable schema, it makes it very difficult/complex for a human to read the schema. I think this is important particularly as this is the key metadata information published from data curator - potentially this schema is the only resource available to help understand the data.

Expected Behaviour

I would expect the content of the JSON file to be ordered intuitively. For example, this example is ordered as I would expect: https://raw.githubusercontent.com/frictionlessdata/example-data-packages/master/cpi-data-via-url/datapackage.json

louisjasek avatar Apr 30 '18 06:04 louisjasek

This was partly done in #230. Order isn’t important for a machine and ideally humans aren’t looking at JSON. There is a suggested order in the spec somewhere- I’ll add it here

Stephen-Gates avatar Apr 30 '18 07:04 Stephen-Gates

Property order in files in https://github.com/frictionlessdata/specs/tree/master/schemas/dictionary

Stephen-Gates avatar Apr 30 '18 07:04 Stephen-Gates

Hi @Stephen-Gates @louisjasek Yes as @Stephen-Gates suggested, a json data-structure has no order, but it may be possible to do this in a 'stringified'/'prettied' way on output into a file.

ghost avatar Apr 30 '18 23:04 ghost