Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have a MySQL-table looking like this:
SQL
Year|ZIP Code|Causes of Death|Count|Location
1999|90001   |SUI            |0    |(33.973092999999999, -118.247896)
... |



And I need to create JSON data which looks like this

C#
var data = [
    [
    'seriesA', [ latitude, longitude, magnitude, latitude, longitude, magnitude, ... ]
    ],
    [
    'seriesB', [ latitude, longitude, magnitude, latitude, longitude, magnitude, ... ]
    ]
];


So getting the "Location" and "Count" columns from the MySQL table into the new JSON-file.

Thanks!
Posted

1 solution

Not sure what is stopping you from doing it yourself.

TutorialsPoint: JSON with PHP[^]

W3Schhols: PHP MySQL Database[^]

Your JSON structure doesn't make sense together with the table you are showing.
There is probably some information you are not telling.
 
Share this answer
 
Comments
AdamDedanga 15-Nov-15 20:47pm    
Well,

I'm importing data-sets from CSV-files. So it'll be troublesome to change the table structure manually.

And the JSON structure is from a GitProject: https://github.com/dataarts/webgl-globe
So I'm not the creator of neither the data nor the script that use the JSON data.

Especially JSON is uncharted water for me, so you'll gave to excuse me if I confuse you in any way.
George Jonsson 15-Nov-15 20:53pm    
Are you forced to use that JSON structure or can you create your own?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900