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

Updated examples #10

Closed
evenstensberg opened this issue Aug 19, 2016 · 2 comments
Closed

Updated examples #10

evenstensberg opened this issue Aug 19, 2016 · 2 comments
Labels

Comments

@evenstensberg
Copy link

evenstensberg commented Aug 19, 2016

Hi! Sorry for the disturbance! I'm doing some work in stat now, and the documentation is really scattered. This toolkit is great, and includes a lot of great engineering, but using node and json-stat isn't really covered in examples. I'd like to see something like an example using modern javascript and node in order to convert json-stat to data-structures you could output. The closest thing I've come to this is doing something like in the screenshot, but some of the examples are also outdated, when it comes to transpiling and using webpack, though this is a special use case.

This is the closest thing I've come to extract the data in Node, but as showed in the tonic-dev example, using got fails, due internal errors in babel. If you know a fix to this, I'd very much like to see that!

skjermbilde 2016-08-19 kl 14 33 52

@evenstensberg
Copy link
Author

evenstensberg commented Aug 19, 2016

Right now, this is what I get, but there's a lot of mixed documentation about how to extract the data, and furthermore make them show up as tables in regular js, say if you want to have an array containing ContentsCode, id etc..

Bet it is just me dumbing things down, but JSONstat is pretty new, so I think dumbing things down will help people get the concept 100%

skjermbilde 2016-08-19 kl 14 38 08

@badosa
Copy link
Owner

badosa commented Aug 19, 2016

Check the wiki for documentation, particularly, the API Reference section.

If you managed to retrieve bundle 66000 from Statistics Norway and store it in an object, you'll need to read it with the JSON-stat Javascript Toolkit (JSONstat(obj)), select the first and only dataset in the bundle (Dataset(0)) and probably convert it into an array of objects (toTable({type: "arrobj"})).

JSONstat(obj).Dataset(0).toTable({type: "arrobj"})

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

No branches or pull requests

2 participants