Parses a string and returns either a LazyObject or LazyArray

@param str the source json data
@return either a LazyObject or LazyArray instance
@throws LazyException if the string could not be parsed
19699
public static LazyElement parse(String str) throws LazyException{
		int index=0;
		while(index<str.length()){
			char ch=str.charAt(index);
			if(ch=='['){
				return new LazyArray(str);
			}
			if(ch=='{'){
				return new LazyObject(str);
			}
			index++;
		}
		throw new LazyException("The given string is not a JSON object or array");
	}
514407
public static boolean isJsonArray(String str) {
		if (StrUtil.isBlank(str)) {
			return false;
		}
		return StrUtil.isWrap(str.trim(), '[', ']');
	}
755455
public void parse2DJSON(String str) {
        for (String latlon : str.split("\\[")) {
            if (latlon.trim().length() == 0)
                continue;

            String ll[] = latlon.split(",");
            String lat = ll[1].replace("]", "").trim();
            add(Double.parseDouble(lat), Double.parseDouble(ll[0].trim()), Double.NaN);
        }
    }
171059
public static AbstractType<?> parse(String str) throws SyntaxException, ConfigurationException
    {
        if (str == null)
            return BytesType.instance;

        AbstractType<?> type = cache.get(str);

        if (type != null)
            return type;

        // This could be simplier (i.e. new TypeParser(str).parse()) but we avoid creating a TypeParser object if not really necessary.
        int i = 0;
        i = skipBlank(str, i);
        int j = i;
        while (!isEOS(str, i) && isIdentifierChar(str.charAt(i)))
            ++i;

        if (i == j)
            return BytesType.instance;

        String name = str.substring(j, i);
        i = skipBlank(str, i);

        if (!isEOS(str, i) && str.charAt(i) == '(')
            type = getAbstractType(name, new TypeParser(str, i));
        else
            type = getAbstractType(name);

        // We don't really care about concurrency here. Worst case scenario, we do some parsing unnecessarily
        cache.put(str, type);
        return type;
    }
943101
public CSLDate parse(String str) {
		Map<String, Object> res;
		try {
			Map<String, Object> m = runner.callMethod(
					parser, "parseDateToArray", Map.class, str);
			res = m;
		} catch (ScriptRunnerException e) {
			throw new IllegalArgumentException("Could not update items", e);
		}
		
		CSLDate r = CSLDate.fromJson(res);
		if (r.getDateParts().length == 2 && Arrays.equals(r.getDateParts()[0], r.getDateParts()[1])) {
			r = new CSLDateBuilder(r).dateParts(r.getDateParts()[0]).build();
		}
		return r;
	}
137137
public static String requireNotEmpty(final String str) throws NullPointerException, IllegalArgumentException {
	if (str.length() == 0) {
	    throw new IllegalArgumentException();
	}
	return str;
    }
775919
static public JSONArray parse(String str) throws IOException {
        StringReader strReader = new StringReader(str);
        return parse(strReader);
    }
383714
public static byte[] decodeBytes(String str)
    {
        byte[] ret = null;

        try
        {
            // De-obfuscate the string
            if(str != null)
                ret = Base64.decodeBase64(str.getBytes());
        }
        catch(NoClassDefFoundError e)
        {
            ret = str.getBytes();
            System.out.println("WARNING: unable to decode: "
                +e.getClass().getName()+": "+e.getMessage());
        }

        return ret;
    }
527337
public List<Filter> deserializeFilterList(String str) {
        return load(str, ListWrappers.FilterList.class).getList();
    }
962596
public static StringType getStringType(String str) {
		TreeSet<CharType> set = getTypeSet(str);
		if(set.size()==1){
			CharType c = set.first();
			return char2StringType(c);
		}
		return StringType.M;		
	}
1167802
private T loadLiteralValue(final String str)
	{
		// Literal in-memory value
		final String cachedStr = (inMemoryString != null) ? inMemoryString.get() : null;

		if (StringUtils.equals(str, cachedStr))
		{
			// Cached value is still valid!
		}
		else
		{
			cached = null; // Prevent the old value from being used

			// Cached value is not valid anymore, re-parse
			setCached(clazz.cast(factory.getInstance(clazz).deserialise(str)));

			inMemoryString = new SoftReference<>(str);
		}

		return cached;
	}
764657
public static Set<String> commaDelimitedListToSet(String str) {
        Set<String> set = new TreeSet<String>();
        String[] tokens = commaDelimitedListToStringArray(str);
        Collections.addAll(set, tokens);
        return set;
    }
111639
public static JSONFunction parse( String str ) {
      if( !JSONUtils.isFunction( str ) ) {
         throw new JSONException( "String is not a function. " + str );
      } else {
         String params = JSONUtils.getFunctionParams( str );
         String text = JSONUtils.getFunctionBody( str );
         return new JSONFunction( (params != null) ? StringUtils.split( params, "," ) : null, text != null ? text : "" );
      }
   }
824596
public static String decode(final String str) {
        try {
            return URLDecoder.decode(str, "UTF-8");
        } catch (final Exception e) {
            LOGGER.log(Level.WARN, "Decodes str [" + str + "] failed", e);

            return str;
        }
    }
412061
public static Integer parseInt(final String str) {
        if (null != str) {
            try {
                return new Integer(Integer.parseInt(str.trim()));
            } catch (final Exception e) {
                // :IGNORE:
            }
        }
        return null;
    }
826371
public static JsonNode parse(final String jsonString) {
        if (Strings.isEmpty(jsonString)) {
            return newObject();
        }

        try {
            return createObjectMapper().readValue(jsonString, JsonNode.class);
        } catch (Throwable e) {
            throw new ParseException(String.format("can't parse string [%s]", jsonString), e);
        }
    }
24618
@FromString
    public static DateMidnight parse(String str) {
        return parse(str, ISODateTimeFormat.dateTimeParser().withOffsetParsed());
    }