json streaming in java and inserting into DB

i have a stituation where i have to parse a nested json string which could be more than 2 GB at times. Also, there could be additional fields/arrays that could come in the future. So i had written a generic recursive parser with JsonParser and it works fine. Below is the code where i parse the data and set it to prepared statement (which is generic as well). Each array data corresponds to different tables.

Sample Json:
{
    object1:
    {
        "key1":"value1",
        "key2":"value2",
        ...
    }
    array1:[
        {
            "key1":"value1",
            "key2":"value2",
            ....
            array1Nested1:[
                {
                ...
                },
                {
                ...
                }
            ]
        },
        {
            "key1":"value1",
            "key2":"value2",
            ....
            array1Nested2:[
                {
                ...
                },
                {
                ...
                }
            ]
        },
        
    ],
    array2:[
        {
            "key1":"value1",
            "key2":"value2",
            ....
            array2Nested1:[
                {
                ...
                },
                {
                ...
                }
            ]
        },
        {
            "key1":"value1",
            "key2":"value2",
            ....
            array2Nested2:[
                {
                ...
                },
                {
                ...
                }
            ]
        }
        
    ]
    
}

Parsing code:

public class ParseJson{
    
    Connection con = null;
    PreparedStatement ps = null;
    
    public static void main(String a[]){
        JsonFactory jFactory = new JsonFactory();
        JsonParser jParser = jFactory.createParser("LongJsonString");
        HashMap masterMap = populateMasterMap ();//this will be populated from DB. It contains all the json field to DB column mapping and the insert query to use for each table.
        HashMap statementMap = new HashMap;  
        for(String key: masterMap.keySet()){
          String query = masterMap.get(key);
          PreparedStatement eachArrayPs= con.preparedStatement(query);
          statementMap.put(key, eachArrayPs);
        }
        parseObject(jParser, masterMap, statementMap );
    //iterate the statementMap here and call executeBatch() on each preparedStatement
    }
    
    public static void parseObject(JsonParser jParser, HashMap masterMap, HashMap statementMap){
        try{
           while(jParser.nextNode() != JsonToken.END_OBJECT){
                 String fieldName = jParser.getCurrentName();
                 if(null == fieldName){
                   continue;
                 }
                JsonToken tk = jParser.nextToken();
                if(token == JsonToken.START_OBJECT){
                  parseObject(jParser, masterMap, statementMap );
                }else if(token == JsonToken.START_ARRAY){
                  ps = (PreparedStatement)masterMap.get(fieldName);//here is my problem
                  parseArray(jParser, masterMap, statementMap );
                }else{
                 String value = jParser.getValueAsString();
                 ps.setObject((Integer) masterMap.get(fieldName), value);
                }
            }
        }catch(Exception e){
            //handle exception
        }
    }
    
    public static void parseArray(JsonParser jParser, HashMap masterMap, HashMap statementMap){
        try{
            while(jParser.nextNode() != JsonToken.END_ARRAY){
                JsonToken tk = jParser.getCurrentToken();
                if(token == JsonToken.START_OBJECT){
                    parseObject(jParser, masterMap, statementMap );
                }else if(token == JsonToken.START_ARRAY){
                    parseArray(jParser, masterMap, statementMap );
                }else{
                    //handle others
                }
            }
            
        }catch(Exception e){
            //handle exception
        }
    }
}

My problem here is with the DB insert which is not happening properly. When i have 2 arrays (each array with 2 objects) without nested array, 2 rows (each) are getting inserted in 2 tables which is expected. But when i add a nested array inside an array, for example consider array1 which has 2 objects and each has an inner array with 2 objects. My expectation is outer array 2 records has to be inserted into table 1 and inner array 4 data has to be inserted in table 2. But table1 has 1 record inserted and table 2 has 5 records inserted. On debugging I found that once the inner array of 1st object is processed, and it comes to the 2nd record of array1, its an object and not an array and so the prepared statement instance is still of the inner array. Im struck here. Please assist.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật