[CAM-4999] I cannot set a JSON property to null in untyped scripting languages Created: 18/Nov/15  Updated: 18/Nov/15

Status: Open
Project: camunda BPM
Component/s: spin
Affects Version/s: None
Fix Version/s: None

Type: Bug Report Priority: L3 - Default
Reporter: Thorben Lindhauer Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
is related to CAM-4479 I can check if Spin json value is null Closed


In Javascript (and probably any other untyped scripting language), there is no way to set a JSON property to null using Spin. For example, this fails:

node = S(input, "application/json");
node.prop("order", null);

with the error:

Can't unambiguously select between fixed arity signatures [(java.lang.String, org.camunda.spin.json.SpinJsonNode), (java.lang.String, java.lang.Boolean), (java.lang.String, java.lang.String), (java.lang.String, java.util.Map), (java.lang.String, java.util.List), (java.lang.String, java.lang.Number)] of the method org.camunda.spin.impl.json.jackson.JacksonJsonNode.prop for argument types [java.lang.String, null]

Apparently, some scripting engines have more or less ugly extensions to explicitly select a method. For example, in Nashorn, the problem can be worked around as follows:
node["prop(String, String)"]("order", null);

Generated at Sun Sep 22 18:48:14 CEST 2019 using JIRA 6.4.6#64021-sha1:33e5b454af4594f54560ac233c30a6e00459507e.