Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 988033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:34:47+00:00 2026-05-16T05:34:47+00:00

Dead silence! Not often you experience that on Stackoverflow… I’ve added a small bounty

  • 0

Dead silence! Not often you experience that on Stackoverflow… I’ve added a small bounty to get things going!

I’ve built a json document containing information about the location of various countries. I have added some custom keys. This is the beginning of the json-file:

{
    "type": "FeatureCollection",
    "features": [
        { "type": "Feature", "properties": {
            "NAME": "Antigua and Barbuda", 
            "banned/censored": "AG",   
            "Bombed": 29, 
            "LON": -61.783000, "LAT": 17.078000 },
    "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -61.686668,...

All the custom keys (like bombed, banned/censored etc.) have values, but they are just old (bogus if you want) values. The real values are kept in a .csv file extracted from a excel document.

I e.g. have this:

                            banned/censored     bombed   
Antigua and Barbuda              2                 120
...

Now I want to match these values with the proper key in the json-file. Is there any programs out there that I can use? Another option would be a json library for java, which somehow supports what I want. I havent been able to find an easy solution for it yet. The document is pretty large ~ 10MB, if it makes any difference!

EDIT: I’ve used QGIS to manipulate the .shp file, so some kind of extension could be of use too.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:34:48+00:00Added an answer on May 16, 2026 at 5:34 am

    Just convert both the JSON and the CSV to a fullworthy Java object. This way you can write any Java logic to your taste to alter the Java objects depending on the one or other. Finally convert the modified Java object representing the JSON data back to a JSON string.

    There is however one problem in your JSON. The / in banned/censored is not a valid character for a JSON field name, so many of the existing JSON deserializers may choke on this. If you fix this, then you’ll be able to use one of them.

    I can recommend using Google Gson for the converting between JSON and Java. Here’s a kickoff example based on your JSON structure (with banned/censored renamed to bannedOrCensored):

    class Data {
        private String type;
        private List<Feature> features;
    }
    
    class Feature {
        private String type;
        private Properties properties;
        private Geometry geometry;
    }
    
    class Properties {
        private String NAME;
        private String bannedOrCensored;
        private Integer Bombed;
        private Double LON;
        private Double LAT;
    }
    
    class Geometry {
        private String type;
        private Double[][][][] coordinates;
    }
    

    You only need to add/generate getters and setters yourself. Then, you’ll be able to convert between JSON and Java like follows:

    Data data = new Gson().fromJson(jsonString, Data.class);
    

    To convert between CSV and a Java object, just pick one of the many CSV parsers, like OpenCSV. You can even homegrow your own with help of BufferedReader.

    Finally, after altering the Java object representing the JSON data, you can convert it back to JSON string with help of Gson as follows:

    String json = new Gson().toJson(data);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code checks for dead links. Since 3rd party Ajax requests are not allowed
I know that PHP4 is dead, however there are about two dozen or so
I made a dead simple Console class in AS3 that allows logging to be
I know this is somewhat of a dead horse, but I'm not finding a
This is a brain-dead newbie question, but here goes: What determines what files get
Here's a dead-simple webpage that leaks memory in IE8 using jQuery (I detect memory
I'm currently working with a dead network application that received packets for a chat.
This should be dead simple, but I cannot get it to work for the
UNIX file-locking is dead-easy: The operating system assumes that you know what you are
Not to beat the dead horse , however, I am looking for a way

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.