Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #19460
| Message-ID | <24865100.GETcoMUama@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2013-04-25 10:25 +0200 |
| Subject | Re: Formatting JSON document to Data Table |
| Newsgroups | comp.lang.javascript |
| References | <d6020bd0-9540-4191-bcac-9b296866c8e1@googlegroups.com> |
shawnroller10@gmail.com wrote:
> I need some assistance in creating a data table from a JSON document.
Thank you for _not_ saying (falsely) “JSON object”. I am not sure if
“document” is the correct term either, though.
> The data table format looks like this:
>
> {
> […]
> "rows": [
> {"c":[{"v":"2013-04-21"},{"v":101},{"v":153},{"v":189}]},
> {"c":[{"v":"2013-04-22"},{"v":109},{"v":145},{"v":175}]},
> {"c":[{"v":"2013-04-23"},{"v":95},{"v":165},{"v":201}]},
> {"c":[{"v":"2013-04-24"},{"v":114},{"v":147},{"v":193}]}
> ]
> }
>
> The cols are essentially columns of a table and each of the items in the
> rows array are the values of the columns (ex. {"v":value})
>
> A sample of my data, returned from a query via an Ajax command, might look
> like this:
>
> {{[{
> […]
> {"warehouse_id":"107","date":"2013-04-21","lane":"M01","routes":101}
> "sort" : [ 1366675200000 ]
> }, {
> […]
> {"warehouse_id":"107","date":"2013-04-21","lane":"M02","routes":153}
> "sort" : [ 1366675200000 ]
> }, {
> […]
> {"warehouse_id":"107","date":"2013-04-22","lane":"M01","routes":109}
> "sort" : [ 1366675200000 ]
> } ]
> }
> }...
>
> […]
> Can someone assist in recommending a way to format this data? I'm
> currently using an object, var ldata = {} but I need to put the data into
> the ldata.cols and ldata.rows. The major obstacle is to get the proper
> number (routes) for each lane and for each day.
I do not see the “major obstacle”. What have you tried and how did it fail?
And get a real name, please.
--
PointedEars
Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
Formatting JSON document to Data Table shawnroller10@gmail.com - 2013-04-24 20:15 -0700 Re: Formatting JSON document to Data Table Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-25 10:25 +0200
csiph-web