1

I am wondering how to CLEARLY generate the JSON file from the data based in Excel file.

I know some ways to do it, although as a result I have got sth like this:

{"type":"FeatureCollection","features":[{"type":"Feature","geometry": 
{"type":"Point","coordinates": 
[-0.2105823999999834,52.5905531,0]},"properties":{"name":"PE1 
 5RX","MS_Ref":"REG/LYVELLYGDNS","Owner":"Long Term Reversions (Dulwich) 
 Limited","Client_Ref":"LYVELLYGDNS","Address":"The Keep, Lyvelly Gardens, 
 Peterborough","Postcode":"PE1 }}]}

instead of:

{
"type": "FeatureCollection",

"features": [{
    "type": "Feature",
    "properties": {
        "ID": "1",
        "League": "NL",
        "lat": 33.445278,
        "long": -112.066667,
        "Team": "Arizona Diamondbacks",
        "City": "Phoenix, Arizona",
        "Stadium": "Chase Field",
        "Capacity": "48570",
        "Address": "401 East Jefferson Street",
        "City2": " Phoenix",
        "State-Zip": " Arizona 85001",
        "Logo": "http:\/\/mlb.mlb.com\/mlb\/images\/team_logos\/logo_ari_79x76.jpg",
        "LeagueLogo": "http:\/\/mlb.mlb.com\/mlb\/images\/nl_75x75.png",
        "Name": "Diamondbacks",
        "Website": "http:\/\/arizona.diamondbacks.mlb.com"
    },
    "geometry": {
        "type": "Point",
        "coordinates": [-0.2105823999999834, 52.5905531,0]
    }
}, {
    "type": "Feature",
    "properties": {
        "ID": "2",
        "League": "NL",
        "lat": 33.735206,
        "long": -84.389642,
        "Team": "Atlanta Braves",
        "City": "Atlanta, Georgia",
        "Stadium": "Turner Field",
        "Capacity": "50091",
        "Address": "755 Hank Aaron Drive SE",
        "City2": " Atlanta",
        "State-Zip": " Georgia 30315",
        "Logo": "http:\/\/mlb.mlb.com\/mlb\/images\/team_logos\/logo_atl_79x76.jpg",
        "LeagueLogo": "http:\/\/mlb.mlb.com\/mlb\/images\/nl_75x75.png",
        "Name": "Braves",
        "Website": "http:\/\/atlanta.braves.mlb.com"
    },
    "geometry": {
        "type": "Point",
        "coordinates": [-84.389642, 33.735206]
    }
}]
}

like in the example below:

http://www.gistechsolutions.com/leaflet/DEMO/baseball/BaseballPanel.html

Does anyone knows how to get the clearly generated GeoJSON data like this? Or shall I manage with it manually?

  • For XML I know that notepad++ has a tool to cleanly format it, maybe the same functionality exist for JSON, also there are probably webtool that do it... – J.R Sep 5 at 16:35
  • How do you do it? Using VBA? – MrXsquared Sep 5 at 16:40
  • 1
    This is sometimes called "pretty printing" -- There are lots of "pretty-printers" available for JSON. Python and Java have JSON pretty-printers. – Vince Sep 5 at 16:41
  • No, only MS Excel, saving as a .csv and next via phpmyadmin, where I can save it as a JSON. – Mariusz Krukar Sep 5 at 16:41
0

It looks like I found the solution.

One of it is the JSON pretty printing - mentioned in one of the comment above.

https://jsonformatter.org/json-pretty-print

You can only paste the compact JSON code and get the clear result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.