skip to Main Content

How to change an unnormalized csv file to a complex json or java object

I have the following unnormalized csv file user_id,nickname,joinDate,product_id,price 1,kmh,2023-07-24,P131,3000 1,kmh,2023-07-24,P132,4000 1,kmh,2023-07-24,P133,7000 1,kmh,2023-07-24,P134,9000 2,john,2023-07-24,P135,2500 2,john,2023-07-24,P136,6000 3,alice,2023-07-25,P137,4500 3,alice,2023-07-25,P138,8000 I'm going to change this to the following json format (or java object). [ { "user_id": 1, "nickname": "kmh", "joinDate": "2023-07-24", "orders": [ {…

VIEW QUESTION

PHP – Calculate Array with Non Numeric Value

From mycsv.csv $data[7] has these: 4294967296/4294967296 4294967296 8589934592/8589934592 I want to calculate and put GB, so they become like this: 4GB/4GB 4GB 8GB/8GB What I did: <?php $a = str_ireplace("/"," ",$data[7]); echo (floor($a/1000000000))."GB"; But it gives error for the ones…

VIEW QUESTION
Back To Top
Search