Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19460

Re: Formatting JSON document to Data Table

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!noris.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="UTF-8"
Message-ID <24865100.GETcoMUama@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <usenet@PointedEars.de>
Organization PointedEars Software (PES)
Date Thu, 25 Apr 2013 10:25:01 +0200
User-Agent KNode/4.8.5
Content-Transfer-Encoding 8Bit
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Subject Re: Formatting JSON document to Data Table
Newsgroups comp.lang.javascript
References <d6020bd0-9540-4191-bcac-9b296866c8e1@googlegroups.com>
MIME-Version 1.0
Lines 56
NNTP-Posting-Date 25 Apr 2013 10:25:17 CEST
NNTP-Posting-Host 258cb045.newsspool1.arcor-online.net
X-Trace DXC=V^e7`IDooALI7\_^6>c20Jic==]BZ:afN4Fo<]lROoRAnkgeX?EC@@@>32E0LlHXPKDZm8W4\YJNLb@mF9jNikdE7a5\<`>]gfN=eUoi<@L`IG
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.javascript:19460

Show key headers only | View raw


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


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