Answer the question
In order to leave comments, you need to log in
How to load data into MySQL from JSON file with variable data structure?
There is a file (json-export of a chat from Telegram), which has a variable structure,
[
{
"id": 5,
"type": "message",
"date": "2019-01-02T12:05:43",
"from": "nik",
"from_id": 12457887,
"text": "hi!"
},
{
"id": 6,
"type": "message",
"date": "2019-01-02T12:05:45",
"from": "nik2",
"from_id": 22457877,
"text": [
"hi tyt info!",
{
"type": "link",
"text": "https://telegra.ph/film-05-01"
},
""
]
}
]
' [
"hi tyt info!",
{
"type": "link",
"text": "https://telegra.ph/film-05-01"
},
""
]'
Answer the question
In order to leave comments, you need to log in
In addition to the "text" field, which has some strange structure, the
rest can be distributed into columns.
If text is a string, then it is better to put it into an array right away. Then just a JSON column type.
Is it possible to upload this file to a MySQL database, similar to CSV?In my opinion, no regular utility.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question