mardi 5 juillet 2016

Importing .JSON into MySQL

I have a very large (200k+ lines) and sort of complex .JSON file I need to store in MySQL so that I can query it.

This .JSON is broken up into two main parts, "edges" and "nodes", shown below is an example of both:

{
    "edges": [
        {
            "source": "279364692",
            "target": "282656527",
            "id": "2959",
            "attributes": {
                "Weight": "1.0"
            },
            "color": "rgb(184,178,213)",
            "size": 1.0
        },
        {
            "source": "279364426",
            "target": "3088727691",
            "id": "2122",
            "attributes": {
                "Weight": "1.0"
            },
            "color": "rgb(182,131,187)",
            "size": 1.0
        },
    ],

"nodes": [
    {
        "x": -1281.15625,
        "y": 173.54820251464844,
        "id": "2705660357",
        "attributes": {},
        "color": "rgb(237,248,251)",
        "size": 10.0
    },
    {
        "x": -269.597900390625,
        "y": 1419.9178466796875,
        "id": "3341801730",
        "attributes": {},
        "color": "rgb(237,248,251)",
        "size": 10.0
    }
]
}

My entire .JSON file is exactly the same format as this, everything is under "edges" and "nodes". There are several tutorials on how to import .JSON files, and I have tried most of them. But I haven't found anything that can handle data like mine.

So, how can I store this information in a MySQL database?

Aucun commentaire:

Enregistrer un commentaire