I have next array:
[ {"id" : 1,
"key_word" : "бережливое производствоnканбанnсокращение потерь"
}, {
"id" : 2,
"key_word" : ""
}, {
"id" : 3,
"key_word" : "healthynlearnersnlecturesnphysical educationnphysical fitnessnздоровьеnлекцииnобучающиесяnфизическая культураnфизическая подготовленность"
}, {
"id" : 4,
"key_word" : "collectivenefficiencyngroupnjoint activitynpsychologicalnsocialnsocial cohesionnгруппаnколлективnпсихологическийnсовместная деятельностьnсоциальная сплоченностьnсоциальныйnэффективность"
}]
how to divide this array into separate stream files for example:
{
"id" : 1,
"key_word" : "бережливое производствоnканбанnсокращение потерь"
}
{
"id" : 2,
"key_word" : ""
}
i used EvaluateJsonPath with parameter JSONPath = $.*
and i used SplitJson with parameter JsonPath Expression= $.* and $ don’t work
"id" : 1,
"key_word" : "бережливое производствоnканбанnсокращение потерь"
}, {
"id" : 2,
"key_word" : ""
}, {
"id" : 3,
"key_word" : "healthynlearnersnlecturesnphysical educationnphysical fitnessnздоровьеnлекцииnобучающиесяnфизическая культураnфизическая подготовленность"
}, {
"id" : 4,
"key_word" : "collectivenefficiencyngroupnjoint activitynpsychologicalnsocialnsocial cohesionnгруппаnколлективnпсихологическийnсовместная деятельностьnсоциальная сплоченностьnсоциальныйnэффективность"
}]
2
Answers
You would need to use the
SplitJson
and apply the property JsonPath Expression to$.*
This will split the single large array in multiple JSON in this case 4 file fragments
You can see I got 4 outputs for the single input of the JSON array
I would recommend to use JsonRecordReader and JsonRecordWriter with any of the record based processors. This is the preferred method over splitting. This also allows you to control the upstream schema, and downstream schema, as well as apply SQL-like query against those records.