Minify the json string

@param json is the json string
@return string
431463
public function minify($json){
			$tokenizer = "/\"|(\/\*)|(\*\/)|(\/\/)|\n|\r/";
			$in_string = false;
			$in_multiline_comment = false;
			$in_singleline_comment = false;
			$tmp; $tmp2; $new_str = array(); $ns = 0; $from = 0; $lc; $rc; $lastIndex = 0;
			while (preg_match($tokenizer,$json,$tmp,PREG_OFFSET_CAPTURE,$lastIndex)){
				$tmp = $tmp[0];
				$lastIndex = $tmp[1] + strlen($tmp[0]);
				$lc = substr($json,0,$lastIndex - strlen($tmp[0]));
				$rc = substr($json,$lastIndex);
				if (!$in_multiline_comment && !$in_singleline_comment){
					$tmp2 = substr($lc,$from);
					if (!$in_string){
						$tmp2 = preg_replace("/(\n|\r|\s)*/","",$tmp2);
					}
					$new_str[] = $tmp2;
				}
				$from = $lastIndex;
				if ($tmp[0] == "\"" && !$in_multiline_comment && !$in_singleline_comment){
					preg_match("/(\\\\)*$/",$lc,$tmp2);
					if (!$in_string || !$tmp2 || (strlen($tmp2[0]) % 2) == 0){ // start of string with ", or unescaped " character found to end string
						$in_string = !$in_string;
					}
					$from--; // include " character in next catch
					$rc = substr($json,$from);
				} else if ($tmp[0] == "/*" && !$in_string && !$in_multiline_comment && !$in_singleline_comment){
					$in_multiline_comment = true;
				} else if ($tmp[0] == "*/" && !$in_string && $in_multiline_comment && !$in_singleline_comment){
					$in_multiline_comment = false;
				} else if ($tmp[0] == "//" && !$in_string && !$in_multiline_comment && !$in_singleline_comment){
					$in_singleline_comment = true;
				} else if (($tmp[0] == "\n" || $tmp[0] == "\r") && !$in_string && !$in_multiline_comment && $in_singleline_comment){
					$in_singleline_comment = false;
				} else if (!$in_multiline_comment && !$in_singleline_comment && !(preg_match("/\n|\r|\s/",$tmp[0]))){
					$new_str[] = $tmp[0];
				}
			}
			$new_str[] = $rc;
			return implode("",$new_str);
		}
725708
def to_json(self, minimal=True):
        
        if minimal:
            return json.dumps(self.json_repr(minimal=True), cls=MarathonMinimalJsonEncoder, sort_keys=True)
        else:
            return json.dumps(self.json_repr(), cls=MarathonJsonEncoder, sort_keys=True)
824970
public static String prettyFormatJson(String jsonString) {
        requireNonNull(jsonString, "jsonString is null");
        return JSON.toJSONString(getJSONFromString(jsonString), true);
    }
114130
public static Object getStringFromJSONObject(final String json, final String key) {
        requireNonNull(json, "json is null");
        return JSON.parseObject(json).getString(key);
    }
1008596
public String format(String json) {
        String result = null;
        if (json != null){
            if (json.startsWith("{")) {
                result = new JSONObject(json).toString(4);
            } else if (json.startsWith("[")) {
                JSONObject jsonObject = new JSONObject("{'a': " + json + "}");
                org.json.JSONArray array = (org.json.JSONArray) jsonObject.get("a");
                result = array.toString(4);
            }
        }
        return result;
    }
476086
private Map<String, Object> jsonRepresentation() {
        final Map<String, Object> json = new HashMap<>(getProperties());
        json.put(META_PROP_TYPE, TYPE_BLOB);
        if (blobDigest != null) {
            json.put(PROP_DIGEST, blobDigest);
        }
        else {
            json.put(META_PROP_DATA, getContent());
        }
        return json;
    }
2192
function minify(src) {
       // remove comments
       src = src.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, "$1"); // Remove leading and trailing whitespace from lines

       src = src.replace(/(\\n\s+)|(\s+\\n)/g, ""); // Remove line breaks

       src = src.replace(/(\\r|\\n)+/g, ""); // Remove unnecessary whitespace

       src = src.replace(/\s*([;,[\](){}\\\/\-+*|^&!=<>?~%])\s*/g, "$1");
       return src;
     }
1339151
public static String buildSecretFromJwk(final String json) {
        CommonHelper.assertNotBlank("json", json);

        try {
            final OctetSequenceKey octetSequenceKey = OctetSequenceKey.parse(json);
            return new String(octetSequenceKey.toByteArray(), "UTF-8");
        } catch (final UnsupportedEncodingException | ParseException e) {
            throw new TechnicalException(e);
        }
    }
712444
private static String truncateAsJson(String s, int maxSerializedLength) {
    int resultLength = 0;
    int spaceLeft = maxSerializedLength - 2; // enclosing quotes always consume 2 slots

    for (char c : s.toCharArray()) {
      final boolean charNeedsEscape = c == '\\' || c == '"' || c == '\t';

      spaceLeft -= charNeedsEscape ? 2 : 1;
      if (spaceLeft < 0) {
        break;
      }
      resultLength++;
    }

    return truncate(s, resultLength);
  }
473295
public static final String format(String json) {
		final int len = json.length();
		if (len < 3) {
			return json;
		}
		final StringTokenizer st = new StringTokenizer(json, ",{}[]", true);
		final StringBuilder out = new StringBuilder(len * 2);
		String token;
		int indent = 0;
		while (st.hasMoreTokens()) {
			token = st.nextToken();
			if ("{".equals(token) || "[".equals(token)) {
				indent++;
				out.append(token);
				appendIndent(out, indent);
				continue;
			}
			if ("}".equals(token) || "]".equals(token)) {
				indent--;
				appendIndent(out, indent);
				out.append(token);
				continue;
			}
			if (",".equals(token)) {
				out.append(',');
				appendIndent(out, indent);
				continue;
			}
			out.append(token);
		}
		return out.toString();
	}
405956
public static OptimizationConfiguration fromYaml(String json) {
        try {
            return JsonMapper.getYamlMapper().readValue(json, OptimizationConfiguration.class);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
381137
public static String JSON2HTML(String name) {
    if( name.length() < 1 ) return name;
    if(name == "row") {
      return name.substring(0,1).toUpperCase()+ name.replace("_"," ").substring(1);
    }
    return name.substring(0,1)+name.replace("_"," ").substring(1);
  }
292567
public static String escapeAngleBracketsInJson(String json) {
		if (json == null)
			return null;

		return json.replaceAll("<", "\\\\<").replaceAll(">", "\\\\>");
	}
89327
private byte[] toJSONStringCompressed() {
        String str = toJSONString();
        if (str == null || str.length() == 0) {
            return new byte[0] ;
        }
        byte[] outStr;
        try {
            outStr = compressJSONString(str);
        } catch (IOException e) {
            throw new RuntimeException("Failed to serialize Hashinator Configuration to Compressed JSON .", e);
        }
        return outStr;
    }
283756
function JSONMinifier() {
  const self = this;
  self.process = ({ output }) => JSON.stringify(JSON.parse(output));
}
888301
def json_repr(self, minimal=False):
        
        if self.value:
            return [self.field, self.operator, self.value]
        else:
            return [self.field, self.operator]
1284011
public String toJSONString(final boolean compact) {
        final StringBuilder builder = new StringBuilder();
        formatAsJSON(builder, 0, !compact);
        return builder.toString();
    }