As you can see, the first entry contains a lot of information whereas the second entry contains less information (no entry for "flash" for example).
What I am looking to do is, through C# (or another programming language should you see it more suitable), scan through the JSON file and then populate a MySQL table with the unique column headers. So, for example, the first entry in the file has c.53 unique headings such as filename, filesize, make, model etc.... I'd like the script to put these as column headers and then move on to image 2. If new headers are found, these should be appended and if any duplicates encountered, ignores. Once the JSON file has been completely sifted through for unique entry types, I'd then like the code to then commence populating the respective values into the columns so for example, for image 1, "Apple" would be put into the "Make" field and "iPhone" into the "Model" field etc....
Any suggestions how to do this programatically? Is there a more efficient way of doing this than I suggest above?
You'll have to make two passes over the JSON file, the first to get all the columns and types, second to populate them.
In the first pass I'd create a dictionary with the key being the column name, and the value being the full type. What I mean by full is, for example, you have a string value I'd store 'varchar(50)'. As you pass through the file any time you encounter that key again I'd make sure that my size was enough to store whatever you found.
Then you'd construct the create table SQL command from the items in the dictionary.
Then, make the second pass, populating the columns with the data.
It appears that you only have 4 data types to deal with: int, double, DateTime and String. Create a routine that figures out which you have (string/DateTime always start with ", int/double do not).