mysql - what is the best way to parse big JSON file and insert into database using php? -
I have this large JSON file. The way I am currently using it is:
- Read the entire contents in a string
- Get two json_decode, array
- Array Through loop one record at a time and the formation of my SQL statement
The problem is that the code is ugly. Also, some of these arrays are objects themselves, and in all records Not all values are included. I have to use isset to check that a particular value exists or the default value etc. is to be used. Overall, it works correctly, but the code is ugly. Can I write better in any way?
If you do not want to write the ugly code to generate SQL questions, an ORM propel and theory It is considered to be used which I have personally used.
In principle, there is a method to generate an orange from an object and then simply say the method of saving it.
Take a look at this
Comments
Post a Comment