JSON.stringify在java中 - 机器人 [英] JSON.stringify in java - android

查看:587
本文介绍了JSON.stringify在java中 - 机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么办法可以在android系统执行 JSON.stringify

Is there any way to perform a JSON.stringify in android?

我不断看到 JSON.stringify(JSONObject的)各地网络,但我不能找到在Android中的JSON类。

I keep seeing JSON.stringify(JSONObject) all around the web, but I cant find the JSON class in android.

任何帮助吗?

推荐答案

JSON.stringify(JSONObject的)是一个JavaScript函数和Java将无法使用。如果您使用的 org.json。* 包构建在Android SDK,相当于是简单地调用的toString()的JSONObject 实例,或者更人性化的toString(INT)

JSON.stringify(JSONObject) is a Javascript function and will not be available in Java. If you're using the org.json.* package built in the Android SDK, the equivalent would be to simply call toString() on your JSONObject instance, or the more human-friendly toString(int).

<一个href=\"http://developer.android.com/reference/org/json/JSONObject.html#toString()\">http://developer.android.com/reference/org/json/JSONObject.html#toString()
<一href=\"http://developer.android.com/reference/org/json/JSONObject.html#toString(int)\">http://developer.android.com/reference/org/json/JSONObject.html#toString(int)

JSONObject obj = ...
String jsonString = obj.toString(4);

这篇关于JSON.stringify在java中 - 机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆