Convert json to multiple insert sql format
Hi All,
Greetings!
Assume that I have a data flow, and the final result is inserting to the SQL database (Microsoft), but the step before! I have the following JSON format for each flow file content as following:
{
"sbrActivityType" : {
"1" : "ACT+A",
"3" : "ACT+A",
"2" : "ACT+X",
"5" : "ACT+X",
"4" : "ACT+X"
},
"sbrDateTime" : "Sun Mar 19 13:45:15 AST 2023"
}
Then, my desired output format look like the following:
INSERT INTO sbrTestNifiData (sbrActivityType, sbrDateTime) VALUES (?, ?)
So, it does not insert correctly to my database table which is looks like the following:
CREATE TABLE [dbo].[sbrTestNifiData](
[sbrId] [int] IDENTITY(1,1) NOT NULL primary key,
[sbrActivityType] [varchar](50) NULL,
[sbrDateTime] [varchar](50) NULL
);
So, it should inserted to my database table as a five records:
| sbrId | sbrActivityType | sbrDateTime |
| 1 | ACT+A | Sun Mar 19 11:56:40 AST 2023 |
| 2 | ACT+A | Sun Mar 19 11:56:40 AST 2023 |
| 3 | ACT+X | Sun Mar 19 11:56:40 AST 2023 |
| 4 | ACT+X | Sun Mar 19 11:56:40 AST 2023 |
| 5 | ACT+X | Sun Mar 19 11:56:40 AST 2023 |

