0

Actually, I have three main issues coming up. Firstly I have 1 JSON file containing about 1 million records. I want to create a database from that file but the issue is the JSON is multilevel (as I am a newbie to this type of work) I don't know which approach would work in this scenario.

I choose to work on PHP and MySQL. When I tried to create a database there is an issue with the JSON file that it does not contain a comma at the end of the row like this.

{
    "id": "IwrE5aE1DJ1v-juBWsVODg_0000",
    "full_name": "dianne webster",
    "first_name": "dianne",
    "middle_initial": "w",
    "middle_name": "wahl",
    "last_name": "webster",
    "gender": "female",
    "birth_year": null,
    "birth_date": null,
    "linkedin_url": "linkedin.com/in/dianne-wahl-webster-258578190",
    "linkedin_username": "dianne-wahl-webster-258578190",
    "linkedin_id": null,
    "facebook_url": null,
    "facebook_username": null,
    "facebook_id": null,
    "twitter_url": null,
    "twitter_username": null,
    "github_url": null,
    "github_username": null,
    "work_email": null,
    "mobile_phone": null,
    "industry": null,
    "job_title": "music teacher and director",
    "job_title_role": "education",
    "job_title_sub_role": "teacher",
    "job_title_levels": [
        "director"
    ],
    "job_company_id": null,
    "job_company_name": null,
    "job_company_website": null,
    "job_company_size": null,
    "job_company_founded": null,
    "job_company_industry": null,
    "job_company_linkedin_url": null,
    "job_company_linkedin_id": null,
    "job_company_facebook_url": null,
    "job_company_twitter_url": null,
    "job_company_location_name": null,
    "job_company_location_locality": null,
    "job_company_location_metro": null,
    "job_company_location_region": null,
    "job_company_location_geo": null,
    "job_company_location_street_address": null,
    "job_company_location_address_line_2": null,
    "job_company_location_postal_code": null,
    "job_company_location_country": null,
    "job_company_location_continent": null,
    "job_last_updated": "2020-09-01",
    "job_start_date": null,
    "job_summary": null,
    "location_name": "baltimore, maryland, united states",
    "location_locality": "baltimore",
    "location_metro": "baltimore, maryland",
    "location_region": "maryland",
    "location_country": "united states",
    "location_continent": "north america",
    "location_street_address": null,
    "location_address_line_2": null,
    "location_postal_code": null,
    "location_geo": "39.29,-76.61",
    "location_last_updated": "2020-09-01",
    "linkedin_connections": null,
    "inferred_salary": "45,000-55,000",
    "inferred_years_experience": null,
    "summary": null,
    "phone_numbers": [
    ],
    "emails": [
    ],
    "interests": [
    ],
    "skills": [
    ],
    "location_names": [
        "baltimore, maryland, united states"
    ],
    "regions": [
        "maryland, united states"
    ],
    "countries": [
        "united states"
    ],
    "street_addresses": [
    ],
    "experience": [
        {
            "company": null,
            "start_date": null,
            "end_date": null,
            "title": {
                "name": "music teacher and director",
                "role": "education",
                "sub_role": "teacher",
                "levels": [
                    "director"
                ]
            },
            "location_names": [
            ],
            "is_primary": true,
            "summary": null
        }
    ],
    "education": [
    ],
    "profiles": [
        {
            "network": "linkedin",
            "id": null,
            "url": "linkedin.com/in/dianne-wahl-webster-258578190",
            "username": "dianne-wahl-webster-258578190"
        }
    ],
    "certifications": [
    ],
    "languages": [
    ],
    "version_status": {
        "status": "unchanged",
        "contains": [
        ],
        "previous_version": "12.0",
        "current_version": "13.0"
    }
} ***//the comma should be here on each row.***

at the closing curly brace, the comma should be used but I don't know how to do it.

  1. How to create the database in the best possible way?
  2. I want to load the data from the JSON file into the database as there will be 84 columns in the database how I will create the mother-loving query for insert update and delete?
  3. how I will create the array thingy in the database to store profiles and other stuff containing arrays in the database

Looking forward to your answers as I don't know where to share my concerns. THANKS

  • basically you have to convert unto raays and then rebuild the hole by hand https://stackoverflow.com/questions/59949658/how-can-i-parse-nested-json-and-store-into-mysql-database – nbk Sep 12 '21 at 15:47
  • Thanks I got the point but how should I reformat the JSON and add a comma after every nested line – Raza Chishti Sep 12 '21 at 18:52

1 Answers1

0

here is how I solved these issues

  1. I found that we can use any type of database as far as it is normalized and stores all the data as per the requirements.
  2. you can use the software on a trial version that can help you validate a large JSON file within seconds.
  3. you can refer to this link for the extracting arrays it helped a lot