code: private static JsonStructure toJson( VarValueDef value)
      {
      JsonObjectBuilder builder = Json.createObjectBuilder();
  
      if( value.getType().equals( FAILURE))
        {
        builder.add( FAILURE_KEY, true);
        }
      else if( value.getType().equals( ONCE))
        {
        builder.add( ONCE_KEY, true);
        }
  
      addAnnotations( builder, value);
  
      ConditionJson.toJson( value).ifPresent( json -> builder.add( WHEN_KEY, json));
        
      addProperties( builder, value);
  
      return builder.build();
      }
docs: Returns the JSON object that represents the given value definition.