[PageOneX] [dev] Basic doubt about exporting to json

pablo rey pablo at basurama.org
Sun Mar 2 11:54:29 EST 2014


Hi there,
I am trying to use the json file exported from a PageOneX thread to make
other d3 visualizations using data from multiple threads.

The version that I need, with all the values properly written (code, media,
date) should look like:
A.
{
"media":["Buenos Aires Económico","Buenos Aires Herald"],
"codes":["First code","Second Code"],
"dates":["2013-09-02","2013-09-03","2013-09-04"],
"colors":{"First code":"#ff0000","Second Code":"#9900ff"},
"data":    [
{"id":"2013-09-02:Buenos Aires Económico:First
code","date":"2013-09-02","media":"Buenos Aires
Económico","country":"Argentina","code":"First
code","percent":0.886107948969578,"image_count":2},
{"id":"2013-09-02:Buenos Aires Económico:Second
Code","date":"2013-09-02","media":"Buenos Aires
Económico","country":"Argentina","code":"Second
Code","percent":0.0,"image_count":2},
{"id":"2013-09-02:Buenos Aires Herald:First
code","date":"2013-09-02","media":"Buenos Aires
Herald","country":"Argentina","code":"First
code","percent":0.0,"image_count":2},
{"id":"2013-09-02:Buenos Aires Herald:Second
Code","date":"2013-09-02","media":"Buenos Aires
Herald","country":"Argentina","code":"Second
Code","percent":0.28644534412955464,"image_count":2},
{"id":"2013-09-03:Buenos Aires Económico:First
code","date":"2013-09-03","media":"Buenos Aires
Económico","country":"Argentina","code":"First
code","percent":0.0,"image_count":2},
{"id":"2013-09-03:Buenos Aires Económico:Second
Code","date":"2013-09-03","media":"Buenos Aires
Económico","country":"Argentina","code":"Second
Code","percent":0.0,"image_count":2},
{"id":"2013-09-03:Buenos Aires Herald:First
code","date":"2013-09-03","media":"Buenos Aires
Herald","country":"Argentina","code":"First
code","percent":0.0,"image_count":2},
{"id":"2013-09-03:Buenos Aires Herald:Second
Code","date":"2013-09-03","media":"Buenos Aires
Herald","country":"Argentina","code":"Second
Code","percent":0.0,"image_count":2},
{"id":"2013-09-04:Buenos Aires Económico:First
code","date":"2013-09-04","media":"Buenos Aires
Económico","country":"Argentina","code":"First
code","percent":0.3507912159947558,"image_count":2},
{"id":"2013-09-04:Buenos Aires Económico:Second
Code","date":"2013-09-04","media":"Buenos Aires
Económico","country":"Argentina","code":"Second
Code","percent":0.1576519174041298,"image_count":2},
{"id":"2013-09-04:Buenos Aires Herald:First
code","date":"2013-09-04","media":"Buenos Aires
Herald","country":"Argentina","code":"First
code","percent":0.0,"image_count":2},
{"id":"2013-09-04:Buenos Aires Herald:Second
Code","date":"2013-09-04","media":"Buenos Aires
Herald","country":"Argentina","code":"Second
Code","percent":0.15508502024291498,"image_count":2}]}


But what I get from the export.json ifle is:

B.
{"media":["Buenos Aires Económico","Buenos Aires Herald"],
"codes":["First code","Second Code"],
"dates":["2013-09-02","2013-09-03","2013-09-04"],
"colors":{"First code":"#ff0000","Second Code":"#9900ff"},
"data":{
"2013-09-02":{"Buenos Aires Económico":{"First
code":0.886107948969578,"Second Code":0.0},"Buenos Aires Herald":{"First
code":0.0,"Second Code":0.28644534412955464},"Total":{"First
code":0.443053974484789,"Second Code":0.14322267206477732}},
"2013-09-03":{"Buenos Aires Económico":{"First code":0.0,"Second
Code":0.0},"Buenos Aires Herald":{"First code":0.0,"Second
Code":0.0},"Total":{"First code":0.0,"Second Code":0.0}},
"2013-09-04":{"Buenos Aires Económico":{"First
code":0.3507912159947558,"Second Code":0.1576519174041298},"Buenos Aires
Herald":{"First code":0.0,"Second
Code":0.15508502024291498},"Total":{"First code":0.1753956079973779,"Second
Code":0.1563684688235224}}}}

Esentially B hasthe same data that A but coded simpler and with no "keys".
I need the A option, how can I get it or obtain in from the B option? Would
it be better to offer a export.json file like the A option instead of the B
option.

Thanks!
p
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/pageonexdev/attachments/20140302/2274809b/attachment.htm


More information about the Pageonexdev mailing list