Convert the input JSON String to a {@link ScriptModuleSpec}
979036
@Override
    public ScriptModuleSpec deserialize(String json) {
        Objects.requireNonNull(json, "json");
        ScriptModuleSpec moduleSpec = SERIALIZER.fromJson(json, ScriptModuleSpec.class);
        return moduleSpec;

    }
823127
private JSONObject patternToJson() {

        JSONObject pattern = new JSONObject();
        if (null != getPatternType()) {
            pattern.put(JsonKey.PATTERN_TYPE, new JSONString(getPatternType().toString()));
            switch (getPatternType()) {
                case DAILY:
                    if (isEveryWorkingDay()) {
                        pattern.put(JsonKey.PATTERN_EVERYWORKINGDAY, JSONBoolean.getInstance(true));
                    } else {
                        pattern.put(JsonKey.PATTERN_INTERVAL, new JSONString(String.valueOf(getInterval())));
                    }
                    break;
                case WEEKLY:
                    pattern.put(JsonKey.PATTERN_INTERVAL, new JSONString(String.valueOf(getInterval())));
                    pattern.put(JsonKey.PATTERN_WEEKDAYS, toJsonStringList(getWeekDays()));
                    break;
                case MONTHLY:
                    pattern.put(JsonKey.PATTERN_INTERVAL, new JSONString(String.valueOf(getInterval())));
                    if (null != getWeekDay()) {
                        pattern.put(JsonKey.PATTERN_WEEKS_OF_MONTH, toJsonStringList(getWeeksOfMonth()));
                        pattern.put(JsonKey.PATTERN_WEEKDAYS, toJsonStringList(getWeekDays()));
                    } else {
                        pattern.put(JsonKey.PATTERN_DAY_OF_MONTH, new JSONString(String.valueOf(getDayOfMonth())));
                    }
                    break;
                case YEARLY:
                    pattern.put(JsonKey.PATTERN_MONTH, new JSONString(String.valueOf(getMonth())));
                    if (null != getWeekDay()) {
                        pattern.put(JsonKey.PATTERN_WEEKS_OF_MONTH, toJsonStringList(getWeeksOfMonth()));
                        pattern.put(JsonKey.PATTERN_WEEKDAYS, toJsonStringList(getWeekDays()));
                    } else {
                        pattern.put(JsonKey.PATTERN_DAY_OF_MONTH, new JSONString(String.valueOf(getDayOfMonth())));
                    }
                    break;
                case INDIVIDUAL:
                    pattern.put(JsonKey.PATTERN_DATES, datesToJsonArray(getIndividualDates()));
                    break;
                case NONE:
                default:
                    break;
            }
        }
        return pattern;
    }
1092796
static String jsonStringify(String stringValue) {
        StringBuilder sb = new StringBuilder();
        for (char ch : stringValue.toCharArray()) {
            switch (ch) {
                case '"':
                    sb.append("\\\"");
                    break;
                case '\\':
                    sb.append("\\\\");
                    break;
                case '/':
                    sb.append("\\/");
                    break;
                case '\b':
                    sb.append("\\b");
                    break;
                case '\f':
                    sb.append("\\f");
                    break;
                case '\n':
                    sb.append("\\n");
                    break;
                case '\r':
                    sb.append("\\r");
                    break;
                case '\t':
                    sb.append("\\t");
                    break;
                default:
                    sb.append(ch);
            }
        }
        return sb.toString();
    }
1032081
function returnJSON(finalResp, res) {
    if (JSONformat === 'JSON') {
      res.set('Content-Type', `application/json; charset=${encoding}`);
      res.json(finalResp);
    } else {
      res.set('Content-Type', `text/plain; charset=${encoding}`);
      res.send(JSON.stringify(finalResp));
    }
  }
628187
@Override
	public String toJSONString(int indentFactor) throws JSONException {
		final StringWriter w = new StringWriter();
		return this.write(w, indentFactor, 0).toString();
	}
884114
@Override
    public String evalStrictToString(String script) {
        Object returnedObject = context.evaluateString(scope, script, "<cmd>", 1, null);
        String unwrappedObject = unwrapProcessedObjectToString(returnedObject);

        if (unwrappedObject != null) {
            return unwrappedObject;
        } else return "null";
    }
1022435
public static Object getInjectValue(String string) {
        Matcher m = pattern.matcher(string);
        StringBuffer sb = new StringBuffer();
        // Parse the content inside pattern "${}" when this pattern is found
        while (m.find()) {
            // Get parsing result
            Object value = getValue(m.group(1));
            // Return directly when the parsing result don't need to be casted to String
            if (!(value instanceof String)) {
                return value;
            }
            m.appendReplacement(sb, (String) value);
        }
        return m.appendTail(sb).toString();
    }
746423
private static String toJsonStr(Object object) throws JsonGenerationException, JsonMappingException, IOException{
        return mapper.writeValueAsString(object);
    }
1180846
static List<ScriptObjectMirror> getModulesByType(String type,Object value) {
        //print("getModuleByType: " + type + ":" + value);
        List<ScriptObjectMirror> list = new ArrayList<>();
        ScriptObjectMirror requires = requires();

        //print("ModuleUtils.getRequiredFileById for modid: "+modid);
        for ( Map.Entry<String,Object> entry : requires.entrySet()) {

            if (entry.getValue() instanceof ScriptObjectMirror)
            {
                ScriptObjectMirror som = (ScriptObjectMirror)entry.getValue();
                Object v = som.getMember(type);
                if (value.equals(v))
                    list.add(som);
            }
        }
        return list;
    }
1373026
function createJsonpCallback( requestSettings, mockHandler, origSettings ) {
		var callbackContext = origSettings && origSettings.context || requestSettings;
		var jsonp = requestSettings.jsonpCallback || ("jsonp" + jsc++);

		// Replace the =? sequence both in the query string and the data
		if ( requestSettings.data ) {
			requestSettings.data = (requestSettings.data + "").replace(CALLBACK_REGEX, "=" + jsonp + "$1");
		}

		requestSettings.url = requestSettings.url.replace(CALLBACK_REGEX, "=" + jsonp + "$1");


		// Handle JSONP-style loading
		window[ jsonp ] = window[ jsonp ] || function( tmp ) {
			data = tmp;
			jsonpSuccess( requestSettings, callbackContext, mockHandler );
			jsonpComplete( requestSettings, callbackContext, mockHandler );
			// Garbage collect
			window[ jsonp ] = undefined;

			try {
				delete window[ jsonp ];
			} catch(e) {}

			if ( head ) {
				head.removeChild( script );
			}
		};
	}
84917
public static GreenPepperServerConfiguration fromString(String input) throws JsonParseException, IOException {
	    JsonParser parser = jsonF.createParser(input);
	    TypeReference<GreenPepperServerConfiguration> ref = new TypeReference<GreenPepperServerConfiguration>() { };
	    return parser.readValueAs(ref);
	}
1160848
public static String toJsonStr(JSON json, int indentFactor) {
		if (null == json) {
			return null;
		}
		return json.toJSONString(indentFactor);
	}
376605
public synchronized String toJson(Object input)
            throws JsonException {
        try {
            //   depth = 0;
            return recurse(input);
        } catch (IOException e) {
            throw new JsonException(e);
        }
    }
1352380
protected Reader doCreateScript(Properties props) {
		BundleStringJsonifier bsj = new BundleStringJsonifier(props, addQuoteToMessageKey);
		String script = template.toString();
		String messages = bsj.serializeBundles().toString();
		script = script.replaceFirst("@namespace", RegexUtil.adaptReplacementToMatcher(namespace));
		script = script.replaceFirst("@messages", RegexUtil.adaptReplacementToMatcher(messages));

		return new StringReader(script);
	}
821816
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();
    }
1328243
private static void getAugmentedScriptSet(int codePoint, ScriptSet result) {
        result.clear();
        UScript.getScriptExtensions(codePoint, result);

        // Section 5.1 step 1
        if (result.get(UScript.HAN)) {
            result.set(UScript.HAN_WITH_BOPOMOFO);
            result.set(UScript.JAPANESE);
            result.set(UScript.KOREAN);
        }
        if (result.get(UScript.HIRAGANA)) {
            result.set(UScript.JAPANESE);
        }
        if (result.get(UScript.KATAKANA)) {
            result.set(UScript.JAPANESE);
        }
        if (result.get(UScript.HANGUL)) {
            result.set(UScript.KOREAN);
        }
        if (result.get(UScript.BOPOMOFO)) {
            result.set(UScript.HAN_WITH_BOPOMOFO);
        }

        // Section 5.1 step 2
        if (result.get(UScript.COMMON) || result.get(UScript.INHERITED)) {
            result.setAll();
        }
    }
1308707
function (string) {
    var modules = string.split(".");
    if (modules.length == 1) {
      return string.charAt(0).toUpperCase() + string.slice(1);
    } else {
      var m = [];
      for (var i=0; i<modules.length; i++) {
        m.push(this.classize(modules[i]));
      }
      return m.join("\\");
    }
  }