Exemple #1
0
    public static object parse(string input, int flags = 0)
    {
        if ((flags & FLAG_REMOVE_COMMENTS) == FLAG_REMOVE_COMMENTS)
        {
            // Remove comments and reset the flag
            flags -= FLAG_REMOVE_COMMENTS;
            input  = Regex.Replace(input, "/\\*[\\w\\W]*?\\*/", "");
        }

        JSONValue jsonValue = JSONParser.parse(input);

        if (jsonValue != null)
        {
            return(jsonValue.getValue());
        }
        return(null);
    }