Converting String into Object Json Array using Java [duplicate] - java
This question already has answers here:
How to read json file into java with simple JSON library
(21 answers)
Closed 5 years ago.
I have this string which located inside external file.
{
"IsValid": true,
"LiveSessionDataCollection": [
{
"CreateDate": "2017-12-27T13:29:06.595Z",
"Data": "Khttp://www8.hp.com/us/en/large-format-printers/designjet-printers/products.html&AbSGOX+SGOXpLXpBF8CXpGOA9BFFPconsole.info('DeploymentConfigName%3DRelease_20171227%26Version%3D1')%3B&HoConfig: Release_20171227&AwDz//////8NuaCh63&Win32&SNgYAJBBYWCYKW9a&2&SGOX+SGOXpF/1en-us&AAAAAAAAAAAAQICBCXpGOAAMBBBB8jl",
"DataFlags": 8,
"DataFlagType": 264,
"LegacyLiveSessionDataType": null,
"LiveSessionId": 1545190526042650,
"MessageNumber": 0,
"StreamId": 0,
"StreamMessageId": 0,
"ProjectId": 201
},
{
"CreateDate": "2017-12-27T13:29:08.887Z",
"Data": "oDB Information Level : Detailed&9BbRoDB Annual Sales : 55000000&BoDB Audience : Mid-Market Business&AoDB%20Audience%20Segment%20%3A%20Retail%20%26%20Distribution&AoDB B2C : true&AoDB Company Name : Clicktale Inc&AoDB SID : 120325490&AoDB Employee Count : 275&AoDB Employee Range : Mid-Market&AoDB%20Industry%20%3A%20Retail%20%26%20Distribution&AoDB Revenue Range : $50M - $100M&AoDB Sub Industry : Electronics&AoDB Traffic : High&AWB9tY/8bvOBBP_({\"a\":[{\"a\":{\"s\":\"w:auto;l:auto;\"},\"n\":\"div53\"}]})&sP_({\"a\":[{\"a\":{\"s\":\"w:auto;l:auto;\"},\"n\":\"div62\"}]})&FP_({\"r\":[\"script2\"],\"m\":[{\"n\":{\"nt\":1,\"tn\":\"SCRIPT\",\"a\":{\"async\":\"\",\"src\":\"http://admin.brightcove.com/js/api/SmartPlayerAPI.js?_=1514381348598\"},\"i\":\"script55\"},\"t\":false,\"pn\":\"head1\"}]})&8GuP_({\"a\":[{\"a\":{\"s\":\"t:0px;mt:0px;l:274.5px;ml:0px;\"},\"n\":\"div442\"}]})&SP_({\"a\":[{\"a\":{\"s\":\"t:0px;mt:0px;l:274.5px;ml:0px;\"},\"n\":\"div444\"}]})&D",
"DataFlags": 8,
"DataFlagType": 264,
"LegacyLiveSessionDataType": null,
"LiveSessionId": 1545190526042650,
"MessageNumber": 1,
"StreamId": 0,
"StreamMessageId": 1,
"ProjectId": 201
},
{
"CreateDate": "2017-12-27T13:29:08.971Z",
"Data": "P_({\"a\":[{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div105\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div114\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div123\"}]})&9B+8P_({\"a\":[{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div167\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div169\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div178\"}]})&JP_({\"a\":[{\"a\":{\"s\":\"mih:457px;\"},\"n\":\"div220\"},{\"a\":{\"s\":\"mih:457px;\"},\"n\":\"div229\"},{\"a\":{\"s\":\"mih:457px;\"},\"n\":\"div238\"}]})&FP_({\"a\":[{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div282\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div291\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div300\"}]})&HP_({\"a\":[{\"a\":{\"s\":\"t:0px;mt:-92px;l:274.5px;ml:0px;\"},\"n\":\"div442\"}]})&HP_({\"a\":[{\"a\":{\"s\":\"t:0px;mt:-92px;l:274.5px;ml:0px;\"},\"n\":\"div444\"}]})&B",
"DataFlags": 8,
"DataFlagType": 264,
"LegacyLiveSessionDataType": null,
"LiveSessionId": 1545190526042650,
"MessageNumber": 2,
"StreamId": 0,
"StreamMessageId": 2,
"ProjectId": 201
},
{
"CreateDate": "2017-12-27T13:29:08.98Z",
"Data": "P_({\"r\":[\"object1\",\"param1\",\"param2\",\"param3\",\"param4\",\"param5\",\"param6\",\"param7\",\"param8\",\"param9\",\"param10\",\"param11\",\"param12\",\"param13\",\"param14\",\"param15\"],\"m\":[{\"n\":{\"nt\":1,\"tn\":\"OBJECT\",\"a\":{\"type\":\"application/x-shockwave-flash\",\"i\":\"LNK--1710e8cd-4820-4be0-8cf0-28d57402afd8LNK--1710e8cd-4820-4be0-8cf0-28d57402afd8\",\"width\":\"720\",\"height\":\"422\",\"c\":\"BrightcoveExperience BrightcoveExperienceID_1039\",\"seamlesstabbing\":\"undefined\"},\"i\":\"object3\"},\"t\":false,\"pn\":\"div443\",\"ps\":\"meta29\"},{\"n\":{\"nt\":1,\"tn\":\"SCRIPT\",\"a\":{\"type\":\"text/javascript\",\"src\":\"http://admin.brightcove.com/js/api/SmartPlayerAPI.js\"},\"i\":\"script56\"},\"t\":false,\"pn\":\"div443\",\"ps\":\"object3\"},{\"n\":{\"nt\":1,\"tn\":\"PARAM\",\"a\":{\"name\":\"allowScriptAccess\",\"v\":\"always\"},\"i\":\"param31\"},\"t\":false,\"pn\":\"object3\"},{\"n\":{\"nt\":1,\"tn\":\"PARAM\",\"a\":{\"name\":\"allowFullScreen\",\"v\":\"true\"},\"i\":\"param32\"},\"t\":false,\"pn\":\"object3\",\"ps\":\"param31\"},{\"n\":{\"nt\":1,\"tn\":\"PARAM\",\"a\":{\"name\":\"seamlessTabbing\",\"v\":\"false\"},\"i\":\"param33\"},\"t\":false,\"pn\":\"object3\",\"ps\":\"param32\"},{\"n\":{\"nt\":1,\"tn\":\"PARAM\",\"a\":{\"name\":\"swliveconnect\",\"v\":\"true\"},\"i\":\"param34\"},\"t\":false,\"pn\":\"object3\",\"ps\":\"param33\"},{\"n\":{\"nt\":1,\"tn\":\"PARAM\",\"a\":{\"name\":\"wmode\",\"v\":\"opaque\"},\"i\":\"param35\"},\"t\":false,\"pn\":\"object3\",\"ps\":\"param34\"},{\"n\":{\"nt\":1,\"tn\":\"PARAM\",\"a\":{\"name\":\"quality\",\"v\":\"high\"},\"i\":\"param36\"},\"t\":false,\"pn\":\"object3\",\"ps\":\"param35\"},{\"n\":{\"nt\":1,\"tn\":\"PARAM\",\"a\":{\"name\":\"bgcolor\",\"v\":\"FFFFFF\"},\"i\":\"param37\"},\"t\":false,\"pn\":\"object3\",\"ps\":\"param36\"}]})&9CAQ",
"DataFlags": 8,
"DataFlagType": 264,
"LegacyLiveSessionDataType": null,
"LiveSessionId": 1545190526042650,
"MessageNumber": 3,
"StreamId": 0,
"StreamMessageId": 3,
"ProjectId": 201
},
{
"CreateDate": "2017-12-27T13:29:09.413Z",
"Data": "P_({\"a\":[{\"a\":{\"s\":\"w:720px;h:422px;p:relative;\"},\"n\":\"div443\"},{\"a\":{\"s\":\"p:relative;\"},\"n\":\"div445\"}],\"r\":[\"script55\"],\"m\":[{\"n\":{\"nt\":1,\"tn\":\"DIV\",\"a\":{\"c\":\"spooler\",\"s\":\"d:block;o:0;\"},\"i\":\"div451\"},\"t\":false,\"pn\":\"div443\"},{\"n\":{\"nt\":1,\"tn\":\"DIV\",\"a\":{\"c\":\"ispl_sm\",\"s\":\"o:1;\"},\"i\":\"div452\"},\"t\":false,\"pn\":\"div451\"},{\"n\":{\"nt\":1,\"tn\":\"DIV\",\"a\":{\"c\":\"layer\",\"s\":\"o:1;\"},\"i\":\"div453\"},\"t\":false,\"pn\":\"div451\",\"ps\":\"div452\"},{\"n\":{\"nt\":1,\"tn\":\"DIV\",\"a\":{\"c\":\"spooler\",\"s\":\"d:block;o:0;\"},\"i\":\"div454\"},\"t\":false,\"pn\":\"div445\"},{\"n\":{\"nt\":1,\"tn\":\"DIV\",\"a\":{\"c\":\"ispl_sm\",\"s\":\"o:1;\"},\"i\":\"div455\"},\"t\":false,\"pn\":\"div454\"},{\"n\":{\"nt\":1,\"tn\":\"DIV\",\"a\":{\"c\":\"layer\",\"s\":\"o:1;\"},\"i\":\"div456\"},\"t\":false,\"pn\":\"div454\",\"ps\":\"div455\"}]})&9CA5P_({\"a\":[{\"a\":{\"s\":\"d:block;o:0.0282439;\"},\"n\":\"div451\"},{\"a\":{\"s\":\"o:0.989022;\"},\"n\":\"div453\"},{\"a\":{\"s\":\"d:block;o:0.0282439;\"},\"n\":\"div454\"},{\"a\":{\"s\":\"o:0.989022;\"},\"n\":\"div456\"}]})&W",
"DataFlags": 8,
"DataFlagType": 264,
"LegacyLiveSessionDataType": null,
"LiveSessionId": 1545190526042650,
"MessageNumber": 4,
"StreamId": 0,
"StreamMessageId": 4,
"ProjectId": 201
}
]
I am trying to parse it into JSON array object , when I searched for it in Google I found the following solution:
JSONArray jsonArray = new JSONArray("path_to_file_to_parse");
but when I wrote it inside my code I got an error. Is there another way to make it?
I am using json-simple version 1.1
Have you looked at Jackson Tree Model?
//first, you create a mapper object
ObjectMapper mapper = new ObjectMapper();
//then you create a JsonNode instance representing your JSON root structure
//you will need to define json yourself to run the code.
JsonNode root = null;
try {
root = mapper.readTree(json);
} catch (IOException e) {
System.out.println("Some Error");
}
//here you get the list of your session nodes
JsonNode list = root.path("LiveSessionDataCollection");
//then you can iterate through them and get any inner value
for (JsonNode session : list) {
//for example, you can get the create date or live session id.
System.out.println(session.path("CreateDate"));
System.out.println(session.path("LiveSessionId"));
}
I may not be understanding your question fully but I think this is what you're after.
Related
How to get value from json using restassured
I have json and there is array of 'products'. { "data": [ { "contact_id": "...", "email": "...", "first_name": "...", "hash_campaign": "", "hash_campaign_valid_to_date": null, "hash_password": "", "last_name": "...", "loans": [ ], "max_available_loan_amount": 2000.00, "middle_name": "P", "mobile": "...", "personal_id": "...", "product_code": 2, "products": [ { "available_loan_terms": [ 15, 21, 30, 7, 45 ], "default_amount": 0, "default_term": 15, "document_required": 0, "max_available_loan_amount": 2000.00, "max_loan_amount": 0, "max_monthly_payment": 0.00, "product_code": 2 }, { "available_loan_terms": [ 3, 6, 4, 5 ], "default_amount": 0, "default_term": 0, "document_required": 0, "max_available_loan_amount": 4000.00, "max_loan_amount": 0, "max_monthly_payment": 1300.00, "product_code": 101 }, { "available_loan_terms": [ 3, 6, 4, 5 ], "default_amount": 0, "default_term": 0, "document_required": 0, "max_available_loan_amount": 3000.00, "max_loan_amount": 0, "max_monthly_payment": 1510.00, "product_code": 100 } ], "scoring_through_zoral": "0" } ], "description": "...", "requestId": "...", "status": 8888 } I would like to get values of fields 'default_term' and 'max_available_loan_amount' only for product with code 2. I use restassured I've tried List<List> lists = response.body().jsonPath().getList("data.products"); but this code returns list with only one item, I mean all products in one item... how can I get information for first item in products array from this json ???
Step 1: Create POJO to mapping import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; #Data #JsonIgnoreProperties(ignoreUnknown = true) public static class Product { #JsonProperty("default_term") private int default_term; #JsonProperty("max_available_loan_amount") private double max_available_loan_amount; } Step 2: Extract response and deserialize to object. Product product = ...jsonPath().getObject("data[0].products.find {it.product_code == 2}", Product.class); System.out.println(product); //Product(default_term=15, max_available_loan_amount=2000.0)
This could work List<Integer> li_defaultTerm = response.getBody().jsonPath().get("$..products[?(#.product_code=='2')].default_term"); System.out.println(li_defaultTerm.get(0)); //15 List<Double> li_MaxAvailLoanAmount = response.getBody().jsonPath().get("$..products[?(#.product_code=='2')].max_available_loan_amount"); System.out.println(li_MaxAvailLoanAmount.get(0)); //2000.0
Convert the flat Java Object that was created from the DB read, into nested Json object
The threaded comments are stored in Database as flat records with commenId and ParentCommentId. Like below. commentId : 1 userId : 815 userFName:Joe userLName:Doe timeStamp:12345678888 commentText:"" parentCommentId:0 commentId : 2 userId : 615 userFirstName:Ken userLastName:Tait timeStamp:12345678988 commentText:"Comment text" parentCommentId:1 commentId : 3 userId : 415 userFirstName:Brain userLastName:Dell timeStamp:12345678 commentText:"Comment text" parentCommentId:0 I build the Java object using the following Java class public class Comment { int commentId; int userId; String userFName; String userLName; long timeStamp; String commentText; int parCommId; } List<Comment> comments; I have the List of comments object. Now I have to traverse the list and convert this list of comment object into nested Json object. The comment objects with parCommId == 0 are the top level comment and the other comment objects (parCommId != 0) should be nested under the commentId of the comment object. In the above example, the output should be nested like below CommentId_1 CommentId_2 CommentID_3
As suggested in the comments, let's add a List<Comment> field in Comment.class. Then, assuming the input from the DB is: List<Comment> comments = Arrays.asList( new Comment(1, 6, "John", "Snow", 0, "asd", 0), new Comment(2, 6, "Tif", "Snow", 0, "asd2", 1), new Comment(3, 6, "Yur", "Snow", 0, "asd", 2), new Comment(4, 6, "Mrr", "Snow", 0, "asd", 0), new Comment(5, 6, "Mrr", "Snow", 0, "asd", 2) ); You can do the following: Map<Integer, List<Comment>> parentToComments = comments.stream() .collect(Collectors.groupingBy(Comment::getParCommId)); comments.forEach(comment -> { List<Comment> children = parentToComments.get(comment.getCommentId()); comment.setChildren(children); }); ObjectMapper objectMapper = new ObjectMapper(); String commentsJson = objectMapper.writeValueAsString(parentToComments.get(0)); Output: [{ "commentId": 1, "userId": 6, "userFName": "John", "userLName": "Snow", "timeStamp": 0, "commentText": "asd", "parCommId": 0, "children": [{ "commentId": 2, "userId": 6, "userFName": "Tif", "userLName": "Snow", "timeStamp": 0, "commentText": "asd2", "parCommId": 1, "children": [{ "commentId": 3, "userId": 6, "userFName": "Yur", "userLName": "Snow", "timeStamp": 0, "commentText": "asd", "parCommId": 2, "children": null }, { "commentId": 5, "userId": 6, "userFName": "Mrr", "userLName": "Snow", "timeStamp": 0, "commentText": "asd", "parCommId": 2, "children": null }] }] }, { "commentId": 4, "userId": 6, "userFName": "Mrr", "userLName": "Snow", "timeStamp": 0, "commentText": "asd", "parCommId": 0, "children": null }]
Extract values using parallelStream in Java
I have this json Array: "LiveSessionDataCollection": [ { "CreateDate": "2017-12-27T13:29:06.595Z", "Data": "Khttp://www8.hp.com/us/en/large-format-printers/designjet-printers/products.html&AbSGOX+SGOXpLXpBF8CXpGOA9BFFPconsole.info('DeploymentConfigName%3DRelease_20171227%26Version%3D1')%3B&HoConfig: Release_20171227&AwDz//////8NuaCh63&Win32&SNgYAJBBYWCYKW9a&2&SGOX+SGOXpF/1en-us&AAAAAAAAAAAAQICBCXpGOAAMBBBB8jl", "DataFlags": 8, "DataFlagType": 264, "LegacyLiveSessionDataType": null, "LiveSessionId": 1545190526042650, "MessageNumber": 0, "StreamId": 0, "StreamMessageId": 0, "ProjectId": 201 }, { "CreateDate": "2017-12-27T13:29:08.887Z", "Data": "oDB Information Level : Detailed&9BbRoDB Annual Sales : 55000000&BoDB Audience : Mid-Market Business&AoDB%20Audience%20Segment%20%3A%20Retail%20%26%20Distribution&AoDB B2C : true&AoDB Company Name : Clicktale Inc&AoDB SID : 120325490&AoDB Employee Count : 275&AoDB Employee Range : Mid-Market&AoDB%20Industry%20%3A%20Retail%20%26%20Distribution&AoDB Revenue Range : $50M - $100M&AoDB Sub Industry : Electronics&AoDB Traffic : High&AWB9tY/8bvOBBP_({\"a\":[{\"a\":{\"s\":\"w:auto;l:auto;\"},\"n\":\"div53\"}]})&sP_({\"a\":[{\"a\":{\"s\":\"w:auto;l:auto;\"},\"n\":\"div62\"}]})&FP_({\"r\":[\"script2\"],\"m\":[{\"n\":{\"nt\":1,\"tn\":\"SCRIPT\",\"a\":{\"async\":\"\",\"src\":\"http://admin.brightcove.com/js/api/SmartPlayerAPI.js?_=1514381348598\"},\"i\":\"script55\"},\"t\":false,\"pn\":\"head1\"}]})&8GuP_({\"a\":[{\"a\":{\"s\":\"t:0px;mt:0px;l:274.5px;ml:0px;\"},\"n\":\"div442\"}]})&SP_({\"a\":[{\"a\":{\"s\":\"t:0px;mt:0px;l:274.5px;ml:0px;\"},\"n\":\"div444\"}]})&D", "DataFlags": 8, "DataFlagType": 264, "LegacyLiveSessionDataType": null, "LiveSessionId": 1545190526042650, "MessageNumber": 1, "StreamId": 0, "StreamMessageId": 1, "ProjectId": 201 }, { "CreateDate": "2017-12-27T13:29:08.971Z", "Data": "P_({\"a\":[{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div105\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div114\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div123\"}]})&9B+8P_({\"a\":[{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div167\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div169\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div178\"}]})&JP_({\"a\":[{\"a\":{\"s\":\"mih:457px;\"},\"n\":\"div220\"},{\"a\":{\"s\":\"mih:457px;\"},\"n\":\"div229\"},{\"a\":{\"s\":\"mih:457px;\"},\"n\":\"div238\"}]})&FP_({\"a\":[{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div282\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div291\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div300\"}]})&HP_({\"a\":[{\"a\":{\"s\":\"t:0px;mt:-92px;l:274.5px;ml:0px;\"},\"n\":\"div442\"}]})&HP_({\"a\":[{\"a\":{\"s\":\"t:0px;mt:-92px;l:274.5px;ml:0px;\"},\"n\":\"div444\"}]})&B", "DataFlags": 8, "DataFlagType": 264, "LegacyLiveSessionDataType": null, "LiveSessionId": 1545190526042650, "MessageNumber": 2, "StreamId": 0, "StreamMessageId": 2, "ProjectId": 201 }] And I am trying to get all DataFlagType values using parallelStream() and forEach(). This is the code I have written but I am getting error: jsonArray = (JSONArray) json.get("LiveSessionDataCollection"); jsonArray.parallelStream().forEach( x -> ((JSONObject) dataFlagType = (JSONObject) jsonArray.get(1))); I don't know exactly how to work with parallelStream(). How can I achieve getting all DataFlayType values from the json array (as int)?
You first need to get a stream of all object's DataFlagType attribute then collect it in a list: jsonArray.parallelStream().map(x-> ((JSONObject)x).get("DataFlagType")).collect(Collectors.toList()) Output: [264,264,264]
How to get Json data from java website by using Codeigniter3?
I'm going to select data which return value from third party website as below Json objects format and that website build in Java languages and tomcat database. Issue How to get contain from that websites? Server description URL:http://103.5.126.24/PalmHallServer/coodraw/coodraw!queryAllProduct.action Return data json objects, luckDrawProductList for all product information array, { "LuckDrawProductList": [ { "BaseTime": 20140119133000, "CommissionRatio": 10, "DeductBetCount": 1, "Detail": "You can enter any amount between ...", "Enable": 1, "FreeResDiscount": 1, "LotteryTime": 20151016164500, "LuckDrawDesc": "DRAW1", "LuckDrawDiscount": 1, "MaxLuckNumLen": 5, "MaxMoney": 2000000, "MinLuckNumLen": 5, "MinMoney": 100, "NextStartTime": "2015-10-16 12:00:00", "NextStopTime": "2015-10-16 16:15:00", "OpenDrawType": -1, "PeriodUnit": 1, "PeriodUnitNum": 1, "Price": 40, "ProductCode": "DRAW1", "ProductDesc": "Draw1", "ProductEndTime": 20990119163000, "ProductId": 11111, "ProductType": 11, "Rate": 0, "ResTmplProductId": 11111, "StopTime": 1800, "ValidPeriod": 2 } ], "Period": "201510161645" }
Please try code below $URL = "http://103.5.126.24/PalmHallServer/coodraw/coodraw!queryAllProduct.action"; $content = file_get_contents($URL); // get json data using file_get_content $content_arr = json_decode($content); // json data to php array. OR if you wish to use curl $s = curl_init(); curl_setopt($s,CURLOPT_URL,$this->_url); curl_setopt($s,CURLOPT_RETURNTRANSFER,true); $result = curl_exec($s); curl_close($s); $content_arr = json_decode($result); // json data to php array. Then you could print_r($content_arr) and check "LuckDrawProductList" the key or access $content_arr['LuckDrawProductList][0]
filter a json array (which has million items) based on search criteria
I am at loss of finding the best way to filter a json array (which has million items) based on some search criteria which keeps on changning. eg: find all items based on region_id and pool_id The json array format as below [ { "url": "webservices/rest/resources/1/", "id": 1, "name": "con A", "is_parent": 1, "account_id": 1, "pool_id": 4, "region_id": 5, "market_id": 1, "baseline_type": "Type 1", "is_producer": 0, "utilisation_type": 0, "forecasting_algorithm": "Clipped nominal capacity", "availability_protocol": null, "communication_protocol": "OPC", "activation_protocol": [ " Demo" ], "installed_capacity": 2000.0, "nominal_capacity": 1000.0, "positive_tolerance": 300.0, "negative_tolerance": 300.0, "capacity_fee": 20.0, "energy_fee": 20.0, "activation_fee": 10.0, "parent_resource": null }, { "url": "webservices/rest/resources/2/", "id": 2, "name": "con B", "is_parent": 1, "account_id": 2, "pool_id": 1, "region_id": 4, "market_id": 1, "baseline_type": "Type 1 DW", "is_producer": 1, "utilisation_type": 0, "forecasting_algorithm": "Clipped nominal capacity", "availability_protocol": null, "communication_protocol": " Demo", "activation_protocol": [ " Demo" ], "installed_capacity": 3000.0, "nominal_capacity": 1000.0, "positive_tolerance": 300.0, "negative_tolerance": 300.0, "capacity_fee": 20.0, "energy_fee": 20.0, "activation_fee": 10.0, "parent_resource": null }, . . . // million items ] I tried using the following api's in java Jackson api for converting the json to java objects. Google Guava api for filtering java objects. Is it the best procedure to filter the json data? If not, please advice.