Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
Java - Transform Json structure

I am a novice in Java and I am looking a way to transform Json like in this is example.

I do not know json array, mapper or use List will be more useful for me

Here is the example:

Document received:

 {   
        "data1": "A", 
        "data2": "B", 
        "data3": "C", 
        "data4": [{ 
                       "subdata": [{ 
                                       "subsubdata": "mam" 
                       }, 
                       { 
                                       "subsubdata": "mom" 
                       }, 
                       { 
                                       "subsubdata": "mim" 
                       }] 
        } 
    }

Document transformed:

 { //data  transformed
                    "data1": "A", 
                    "data2": "B", 
                    "data3": "C", 
                    "data4": { 
                                   "subdata": { 
                                                   "subsubdata": "mam" 
                                   } 
                    } 
    }, 
    { 
                    "data1": "A", 
                    "data2": "B", 
                    "data3": "C", 
                    "data4": { 
                                   "subdata": { 
                                                   { 
                                                                   "subsubdata": "mom" 
                                                   } 
                                   } 
                    } 
    }, 
    { 
                    "data1": "A", 
                    "data2": "B", 
                    "data3": "C", 
                    "data4": { 
                                   "subdata": { 
                                                   { 
                                                                   "subsubdata": "mim" 
                                                   } 
                                   } 
                    } 
    } 
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Give a try to Jackson.

With the ObjectMapper class you can transform a Json in a nested Map<String, Object> collection.

ObjectMapper mapper = new ObjectMapper();
TypeReference<Map<String,Object>> typeRef = new TypeReference<Map<String,Object>>() {};
Map<String, Object> rs = mapper.readValue(myJsonString, typeRef);
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!