How to parse Json file in android?

Thanks to any response.

I’ve met some problem with parse the Json file of Facebook’s Graph API in Unity, the codes can run well in the platform of PC but of Android, it met with some error code as " Type ‘Object’ doesn’t support slicing", the codes below is what I used to parse the Json file of Facebook


import System.Globalization;

var url :String =“”;
private var encoding: System.Text.UnicodeEncoding;

function Start ()
// Start a download of the given URL
var www : WWW = new WWW (url);

// Wait for download to complete
yield www;

var t1: String=convertEscString(www.text);
var hh: Hashtable = eval(t1);

for (var i: int=0; i<hh["data"].length; i++)
	Debug.Log("name="+hh["data"]_["name"]+" id="+hh["data"]*["id"]);*_

* }*
the problem seems like Unity with Android platform cannot work with the Object of Hashtable?
Really really wanna some help to make Unity android work with JSON well, thanks to any response
and help.

I believe your issue is with the line var hh: Hashtable = eval(t1);. The eval() function takes a string, parses the code contained within, executes the code, and then returns the result. The result that is returned has an unknown type at compile time. As the Android and iOS platforms require that all data types be known at compile time, the eval() function is not supported on iOS or Android (reference).

You will need to code your own parser for JSON, or use one that already exists (see MiniJSON).

Thanks a lot, I will try to figure these out

Did anyone figure this out? searched everywhere… this is the closest