@vivek jainUse SplitContent processor with below configs

Byte Sequence Format
Byte Sequence
}
}
this sequence needs to match exactly with your json message (i.e in your question you are having 1 tab for first curly braces } and in new line you are having another curly braces).
Keep Byte Sequence
true //this determines whether you need to add the byte sequence or not
Byte Sequence Location
Trailing //if keep byte sequence set to true this property adds the sequence to the end.
So from this processor you are able to split the shown message into 2 individual messages.
Output flowfiles from splits relationship:-
ff1:-
{
"version": "1",
"source": {
"type": "external",
"id": "456"
}
}ff2:-
{
"version": "1",
"source": {
"type": "internal",
"id": "123"
}
}
In addition if you want to make these individual messages into valid json array of messages
Then you can use
Merge content processor with
defragment as merge strategy and change the below properties
Delimiter Strategy
Header
Footer
Demarcator

In this processor we are again merging all the individual json messages into one json array with comma as demarcator.
Output flowfile:-
[{
"version": "1",
"source": {
"type": "internal",
"id": "123"
}
},
{
"version": "1",
"source": {
"type": "external",
"id": "456"
}
}]Now you can use record based processors(convert record..etc) processors to work on chunks of data instead of each message at a time.
-
If the Answer addressed your question, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.