may help you . What made it behave like that is the fact that you referred your data(one record per line) as JSON while your data is not JSON. If it was JSON, then it would at least start and end with  and each line (except for the final one) end with a comma. Since JoltTransformJSON accepts only JSON, it behaved like that.
Any of those help Jolt Specification supports NiFi Expression Language but only for substituting the values inside the spec. That is: Say you have a NiFi attribute : jolt.operation: shift you can refer that inside your spec as: