I have this huge JSON file. Currently the way I am using it is:
- Read the entire contents into a string
- Do json_decode, get the array
- Loop through the array one record at a time and build my SQL insert statement
Problem is, the code is ugly. Also, some of the objects in these arrays are themselves arrays, and not all records contain all values. I have to use isset to check if a particular value is present, or use a default value etc. Overall, it works correctly, but the code is ugly. Is there any way I can write this better?