@@ -2571,6 +2571,38 @@ public void setValidateInput(boolean validateInput) {
25712571 this .validateInput = validateInput ;
25722572 }
25732573
2574+ /**
2575+ * Flag: output NULL_VALUE conversion is enabled
2576+ */
2577+ boolean outputConvertNulls = true ;
2578+
2579+ /**
2580+ * Checks whether output NULL_VALUE conversion is enabled
2581+ */
2582+ public boolean isOutputConvertNulls () {
2583+ return outputConvertNulls ;
2584+ }
2585+
2586+ /**
2587+ * Enable or disable output {@link Jsonata#NULL_VALUE} conversion.
2588+ * Enabled by default, which returns both "Jsonata null" and "Jsonata undefined"
2589+ * as Java null.
2590+ *
2591+ * When disabled, output values might contain
2592+ * <ul>
2593+ * <li>{@link Jsonata#NULL_VALUE} indicating "Jsonata null"
2594+ * <li>Java null indicating "Jsonata undefined"
2595+ * </ul>
2596+ *
2597+ * Manually calling {@link Utils#convertNulls(Object)}
2598+ * on a raw result without output conversion will yield the converted result.
2599+ *
2600+ * @param outputConvertNulls
2601+ */
2602+ public void setOutputConvertNulls (boolean outputConvertNulls ) {
2603+ this .outputConvertNulls = outputConvertNulls ;
2604+ }
2605+
25742606 public Object evaluate (Object input ) { return evaluate (input ,null ); }
25752607
25762608 /* async */
@@ -2614,7 +2646,8 @@ public Object evaluate(Object input, Frame bindings) { // FIXME:, callback) {
26142646 // if (typeof callback === "function") {
26152647 // callback(null, it);
26162648 // }
2617- it = Utils .convertNulls (it );
2649+ if (outputConvertNulls )
2650+ it = Utils .convertNulls (it );
26182651 return it ;
26192652 } catch (Exception err ) {
26202653 // insert error message into structure
0 commit comments