I need to create a stored procedure in mysql that take some fields from DB and create a neasted json object:
Firstly I create a json object as showing below:
{
"form": "Exams tests",
"version": "v3.001.01",
"questions": []
}
And secondly a json array object like this:
{[
{
"ordem": 1,
"num_questions": 1,
"question1": "How old are you?"
"answer1": "I'm 18 years old."
}
{
"ordem": 2,
"num_questions": 2,
"question1": "How old are you?"
"answer1": "I'm 18 years old."
"question2": "Where do you live?"
"answer2": "I live in Boston."
}
{
"ordem": 3,
"num_questions": 1,
"question1": "How old are you?"
"answer1": "I'm 23 years old."
}
]}
And the result query showld be something like this:
{
"form": "Exams tests",
"version": "v3.001.01",
"questions": {[
{
"ordem": 1,
"num_questions": 1,
"question1": "How old are you?"
"answer1": "I'm 18 years old."
}
{
"ordem": 2,
"num_questions": 2,
"question1": "How old are you?"
"answer1": "I'm 18 years old."
"question2": "Where do you live?"
"answer2": "I live in Boston."
}
{
"ordem": 3,
"num_questions": 1,
"question1": "How old are you?"
"answer1": "I'm 23 years old."
}
]}
}
I got an error when I'm trying to insert a nested json array into a json object