It seems that the descriptor/stapler code is unable to parse a JSON string inside of a form field. So slaveAttributes is the string representation retrieved from the Jelly file and cloudAttributes is the JSON representation which is used by the scheduler. I wanted to parse the JSON and the MesosCloud constructor was the best place to do it.

Now if I try to define this field as a JSONObject all the way in the descriptor then it always lands into this exception: "Caused by: java.lang.IllegalArgumentException: Unable to convert to class net.sf.json.JSONObject"

Are you aware of a way to specify the field in the Jelly file as JSON directly? That would eliminate the need for the redundant variables.

        <f:entry title="${%Mesos Offer Selection Attributes}">
            <f:json field="slaveAttributes"/>
        </f:entry>

  @Extension
  public static class DescriptorImpl extends Descriptor<Cloud> {
    private String nativeLibraryPath;
    private String master;
    private String description;
    private String frameworkName;
    //private String slaveAttributes;
    private JSONObject slaveAttributes;
........
.........