Esempio n. 1
0
    /// <summary>
    /// Parses the string json into a value
    /// </summary>
    /// <param name="json">A JSON string.</param>
    /// <returns>An ArrayList, a Hashtable, a double, a string, null, true, or false</returns>
    public static object jsonDecode(string json)
    {
        // save the string for debug information
        MiniJson.lastDecode = json;

        if (json != null)
        {
            char[] charArray = json.ToCharArray();
            int    index     = 0;
            bool   success   = true;
            object value     = MiniJson.parseValue(charArray, ref index, ref success);

            if (success)
            {
                MiniJson.lastErrorIndex = -1;
            }
            else
            {
                MiniJson.lastErrorIndex = index;
            }

            return(value);
        }
        else
        {
            return(null);
        }
    }