OpenSim.Region.ScriptEngine.Shared.Api.OSSL_Api.osParseJSON C# (CSharp) Method

osParseJSON() public method

public osParseJSON ( string JSON ) : Hashtable
JSON string
return System.Collections.Hashtable
        public Hashtable osParseJSON(string JSON)
        {
            CheckThreatLevel(ThreatLevel.None, "osParseJSON");

            m_host.AddScriptLPS(1);

            Object decoded = osParseJSONNew(JSON);
            
            if ( decoded is Hashtable ) {
                return (Hashtable) decoded;
            } else if ( decoded is ArrayList ) {
                ArrayList decoded_list = (ArrayList) decoded;
                Hashtable fakearray = new Hashtable();
                int i = 0;
                for ( i  = 0; i < decoded_list.Count ; i++ ) {
                        fakearray.Add(i, decoded_list[i]);
                }
                return fakearray;
            } else {
                OSSLError("osParseJSON: unable to parse JSON string " + JSON);
                return null;
            }
        }
OSSL_Api