dimerocker and jSON

hey there… i just emailed Dimerocker support about this, but seeing as it’s Sunday, i might as well post here as well, to see if you guys have got any ideas as to whats going on.

There’s a few places where an object (drUtil.drJSON) is referenced in the DR documentation, and even in the DR API. however, this drJSON object doesn’t visibly exist anywhere that i can see in the code, and certainly not in my drUtil.cs script.

there was a call for it in the drDataStore object. I edited that object so that it didn’t call the command, saved, then undid my change and saved again. now i’m getting an error, telling me that drJSON doesn’t exist! how the hell did it work in the first place!?!?

Anyone have any idea what the deal is?

When you updated to drClient 1.3, it created a few compatibility issues.

As of 1.3, the JSON function is in it’s own class, drJSON, which is in the Utilities directory.

If you’re code was:

drUtil.JSON...

it is now

drJSON...

The changes for the 1.3 from 1.2 are found here:
http://wiki.github.com/dimerocker/dimeRocker-Unity-Client/drclient-v13

Fannn-tastic, thanks very much Tempest.

as a matter of fact, i just got the same responce from DR…

also, thanks a lot for that link…

But I try the following and I get an error:

yield drClient.DataStore.Load();
    loadedJsonData=drClient.User.localUser.data;

    teststring=drJSON.JsonDecode(loadedJsonData);

error reads cant cast from source to destination type.
Any ideas?

oh then I tred…

yield drClient.DataStore.Load();
    var loadedJsonData : String = drClient.User.localUser.data;
    loadedData = drJSON.JsonDecode(loadedJsonData);
	teststring=loadedData.ToString();

which gets rid of the error but testString prints as System.Collections.Hashtable.
Anyone?

Can you post how/what you’re saving? That would help determine what is wrong during the loading/decrypting.

Edit:

So, what you get returned is by JSONDecode is a Hashtable, but you’re trying to cast it to a string.

temp = new Hashtable(); 
temp.Add("username", "Bob");
	
yield drClient.DataStore.Save(temp);
yield drClient.DataStore.Load();

var loadedJsonData : String = drClient.User.localUser.data;
var loadedData : Hashtable = drJSON.JsonDecode(loadedJsonData);

username  = loadedData["username"];
Debug.Log(username);

Is this similar to what’s being done in your code? Are you using a Hashtable? This snippet above gets the decoded Hashtable, and then accesses the “username” field, which prints “Bob” in the debug log.

I’m using the example code straight out of your help file on the Dimerocker site.

I know very little of hashtables but presumably that is the only way to save to the datastore.
I’ll try with your example and see what happens.
Cheers!!