With Apache Camel (spring-boot) there was a change in how split handled non-array JSON objects around version 3.13.
Is there any way to "force" the 3.12 behaviour of split? (or get a similar result?)
When splitting the following JSON document:
{
"listOfthings": [
{
"thingA": { "Afield1": "Avalue1","Afield2": "Avalue2"},
"thingB": { "Bfield1": "Bvalue1","Bfield2": "Bvalue2"}
},
{
"thingA": {"Afield1": "Avalue3","Afield2": "Avalue4"},
"thingB": {"Bfield1": "Bvalue3","Bfield2": "Bvalue4"}
}
]
}
In camel version 3.12, the following code:
from("file://read/some/file.json")
.convertBodyTo(String.class)
.unmarshal().json()
.split(simple("${body.get('listOfthings')}"))
.split(simple("${body.get('thingA')}"))
.bean("processBodyBean");
The body that would go to processBodyBean was
{ Afield1: "Avalue1", Afield2: "Avalue2" }
{ Afield1: "Avalue3", Afield2: "Avalue4" }
in versions after 3.12 the body contains the field level key-value pair.
Afield1: "Avalue1"
Afield2: "Avalue2"
Afield1: "Avalue3"
Afield2: "Avalue4"
The "new" behaviour feels logically more accurate - so i'm sure this is not a "bug".
We started with a new project using camel and it was deployed around the time 3.12 was released. We unfortunately wrote it based on the 3.12 behaviour. It's not a major re-write, but it is a significant change to a production system - which has run flawlessly for months.
We are just considering our options before we re-write.