-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
flatten nested object properties for json array data preview display #168
Comments
@AiaRup your first example is just a json config that is converted to flat properties list per this note in docs: https://github.com/RandomFractals/vscode-data-preview#data-preview--files-loading-details Your 2nd example is most likely a json array. However, that json document has nested object properties for the _id and group properties & data preview doesn't try to expend them. Perhaps, it could be improved for the latter use case. Current json array display works best with json docs that contain flat objects, such as in this example: https://github.com/RandomFractals/vscode-data-preview/blob/master/data/json/cars.json |
the only sensible solution for this use case I can propose and try to implement is flattening those objects, so that your json array grid will have the following headers:
this is due to the fact that json can be hierarchical, but we are displaying that data in a grid of rows and columns, which is a flat 2 dimensional format :( |
It seems perfect, thanks a lot for all your hard work! |
btw, data preview also supports .jsonl format, if you just want to create a single json doc using cat Unix command and then preview that json data dump :) see issue #159 for more info |
I am only bringing up jsonl since that and csv/tsv data formats will be the first to get data streaming implemented in the next v. update this month most likely. With data streaming you'll be able to view hundreds of thousands of data rows. More info here: #167 So, if you script your mongo db data dump that way, you'll be good to go and see more data loaded faster in the next data preview ext. update. |
I will check it out, thank you so much! |
might try using json-2-csv for this prior to passing nested json objects to the grid view display which is tabular ... |
actually, might try this json-spread lib instead: https://github.com/gone369/json-spread |
+ updated eslint dev dependency to latest
Hello,
I tried to view a JSON in the data-preview but it appears as [object object].
The raw data looks like this (mongo document):
When I preview only one document it looks like this as a preview:
When I want to look at several documents in a JSON file I see the [object object]:
I don't know if it is a bug or I need to configure something?
Thank a lot!
The text was updated successfully, but these errors were encountered: