在javascript android解析数组?

时间:2014-03-26 09:44:27

标签: javascript android arrays webview

我的应用程序有问题,在这种情况下我使用webview,我成功将数组从java传递到javascript并显示这样的数组。

{recLokUserlain:[{"urut":"8","id_a":"acer@acer.com","waktu":"2013-12-26 11:21:24","latitude":"-7.97431333333333","longitude":"112.659455","tempat":"malang isi sendiri","sts_ol":"0","waktu_update":"2014-02-05 14:37:19"},{"urut":"7","id_a":"ace@ace.com","waktu":"2013-12-26 17:34:46","latitude":"-7.89431333333333","longitude":"112.658455","tempat":"malaang juga","sts_ol":"1","waktu_update":"2014-02-13 11:32:25"}]}

我的问题是,我如何解析数组以获取字符串?

感谢

1 个答案:

答案 0 :(得分:0)

如果您将数组传递为:

{"recLokUserlain":[{"urut":"8","id_a":"acer@acer.com","waktu":"2013-12-26 11:21:24","latitude":"-7.97431333333333","longitude":"112.659455","tempat":"malang isi sendiri","sts_ol":"0","waktu_update":"2014-02-05 14:37:19"},{"urut":"7","id_a":"ace@ace.com","waktu":"2013-12-26 17:34:46","latitude":"-7.89431333333333","longitude":"112.658455","tempat":"malaang juga","sts_ol":"1","waktu_update":"2014-02-13 11:32:25"}]}

您应该能够使用JSON.parse()将包含上述内容的字符串转换为包含内部对象的JavaScript数组。