AE 用Particleillusion官网插件附着在一个物体上就有交叉,怎么解决?

有没有人用过org.json.JSONObject? - 开源中国社区
当前访客身份:游客 [
当前位置:
我用websphere v9beta(支持JAX-RS 2.0)实现restful,下面这段代码
@Path("/getJson1")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject getJSON1() {
String input = "This is input";
String output = "This is output";
JSONObject outputJsonObj = new JSONObject();
outputJsonObj.put("input", input);
outputJsonObj.put("output", output);
return outputJsonO
如果用import com.ibm.json.java.JSONObject实现JsonObject是运行正常的,但是如果用import org.json.JSONObject来实现就会报如下的错
] Problem with writing the data, class org.json.JSONObject, ContentType: application/json
[WARNING ] Interceptor for HelloResource1 has thrown exception, unwinding now
No serializer found for class org.json.JSONObject and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )
按理说org.json跟通用啊?为什么websphere上运行会有这样的问题?
共有1个回答
<span class="a_vote_num" id="a_vote_num_
你引用不同库的同名类当然会报错
更多开发者职位上
有什么技术问题吗?
文心雕码的其它问题相关软件 /多国语言[中文]/ /英文/ /英文/ /中文/ /英文/ /中文/ /英文/ /英文/ /英文/ /中文/顶好评:50%踩坏评:50请简要描述您遇到的错误,我们将尽快予以修正。轮坛转帖HTML方式轮坛转帖UBB方式
304.6M&&&#124;&&中文&&&#124;&&8.4
25.0M/英文/7.0
33.8M/中文/4.7
23.4M/中文/4.8
303M/中文/1.4
651.2M/中文/2.8
41.1M/英文/5.2
11.2M/中文/7.0
如果所创建的JAVA项目不包含JSONObject或者是JSONArray这2个对象, 可以通过添加该jar文件来实现.操作org.json包:首先导入org.json下面的包
package com.import org.json.JSONAimport org.json.JSONEimport org.json.JSONOpublic class
{ public static void main(String args[]) throws JSONException {
String jsonContent = &{'hello':world,'abc':'xyz'}&;
JSONObject jsonObject = new JSONObject(jsonContent);
String str1 = jsonObject.getString(&hello&);
String str2 = jsonObject.getString(&abc&);
System.out.println(str1);
System.out.println(str2);
System.out.println(&------------------&);
jsonContent = &[{'hello':333,'abc':'false','xyz':{'a':1,'b':'ab'}},{'hello':555,'abc':'true','xyz':{'a':2,'b':'ba'}}]&;
JSONArray jsonArray = new JSONArray(jsonContent);
for(int i=0;i&jsonArray.length();i++){
JSONObject jsonobject2=jsonArray.getJSONObject(i);
int value1=jsonobject2.getInt(&hello&);
boolean value2=jsonobject2.getBoolean(&abc&);//
String value3=jsonobject2.getString(&xyz&);
JSONObject jsonobject3=jsonobject2.getJSONObject(&xyz&);
int value4=jsonobject3.getInt(&a&);
String value5=jsonobject3.getString(&b&);
System.out.println(value1);
System.out.println(value2);
System.out.println(value4);
System.out.println(value5);
}}输出结果worldxyz------------------333false1ab555true2bajson正则表达式定义Json 的基本文法是键值对,Key:Value 通过冒号分隔key类型就是字符串 “key1“, ”key2“。。。关键是值类型,json定义了7种值类型:1) 字符串,2) 数值,3) true, 4) false, 5) null, 甚至 6) 数组和 7) 对象 都可以是值类型。
安卓官方手机版
IOS官方手机版
org.json的包
下载帮助西西破解版软件均来自互联网, 如有侵犯您的版权, 请与我们联系。重量级的数据格式交换,如果所创建的JAVA项目不包含JSONObject或者是JSONArray这2个对象, 可以通过添加该jar文件来实现.
操作org.json包:
首先导入org.json下面的包
package com.
import org.json.JSONA
import org.json.JSONE
import org.json.JSONO
public class Test {
public static void main(String args[]) throws JSONException {
String jsonContent = &{'hello':world,'abc':'xyz'}&;
JSONObject jsonObject = new JSONObject(jsonContent);
String str1 = jsonObject.getString(&hello&);
String str2 = jsonObject.getString(&abc&);
System.out.println(str1);
System.out.println(str2);
System.out.println(&------------------&);
jsonContent = &[{'hello':333,'abc':'false','xyz':{'a':1,'b':'ab'}},{'hello':555,'abc':'true','xyz':{'a':2,'b':'ba'}}]&;
JSONArray jsonArray = new JSONArray(jsonContent);
for(int i=0;i&jsonArray.length();i++){
JSONObject jsonobject2=jsonArray.getJSONObject(i);
int value1=jsonobject2.getInt(&hello&);
boolean value2=jsonobject2.getBoolean(&abc&);
// String value3=jsonobject2.getString(&xyz&);
JSONObject jsonobject3=jsonobject2.getJSONObject(&xyz&);
int value4=jsonobject3.getInt(&a&);
String value5=jsonobject3.getString(&b&);
System.out.println(value1);
System.out.println(value2);
System.out.println(value4);
System.out.println(value5);
------------------
json正则表达式定义
Json 的基本文法是键值对,Key:Value 通过冒号分隔
key类型就是字符串 &key1&, &key2&。。。
关键是值类型,json定义了7种值类型:
1) 字符串,2) 数值,3) true, 4) false, 5) null, 甚至 6) 数组和 7) 对象 都可以是值类型。
感谢小林子软件站,终于让我找到这款软件...
本站收录了该软件的相关软件
[size=4][b][url=/soft/11265.html]org.json的包[/url][/b][/size]
[b]软件大小:[/b] 41 KB
[b]软件语言:[/b] 简体中文
[b]软件类别:[/b] 网页辅助
[b]运行环境:[/b] WinXP/2000,Win7/Vista
[b]授权方式:[/b] 绿色版
[b]整理时间:[/b]
[b]软件简介:[/b]
重量级的数据格式交换,如果所创建的JAVA项目不包含JSONObject或者是JSONArray这2个对象, 可以通过添加该jar文件来实现.
操作org.json包:
首先导入org.json下面的包
package com.
import org.json.JSONA
import org.json.JSONE
import org.json.JSONO
public class Test {
public static void main(String args[]) throws JSONException {
String jsonContent = &{'hello':world,'abc':'xyz'}&;
JSONObject jsonObject = new JSONObject(jsonContent);
String str1 = jsonObject.getString(&hello&);
String str2 = jsonObject.getString(&abc&);
System.out.println(str1);
System.out.println(str2);
System.out.println(&------------------&);
jsonContent = &[{'hello':333,'abc':'false','xyz':{'a':1,'b':'ab'}},{'hello':555,'abc':'true','xyz':{'a':2,'b':'ba'}}]&;
JSONArray jsonArray = new JSONArray(jsonContent);
for(int i=0;i&jsonArray.length();i++){
JSONObject jsonobject2=jsonArray.getJSONObject(i);
int value1=jsonobject2.getInt(&hello&);
boolean value2=jsonobject2.getBoolean(&abc&);
// String value3=jsonobject2.getString(&xyz&);
JSONObject jsonobject3=jsonobject2.getJSONObject(&xyz&);
int value4=jsonobject3.getInt(&a&);
String value5=jsonobject3.getString(&b&);
System.out.println(value1);
System.out.println(value2);
System.out.println(value4);
System.out.println(value5);
------------------
json正则表达式定义
Json 的基本文法是键值对,Key:Value 通过冒号分隔
key类型就是字符串 &key1&, &key2&。。。
关键是值类型,json定义了7种值类型:
1) 字符串,2) 数值,3) true, 4) false, 5) null, 甚至 6) 数组和 7) 对象 都可以是值类型。
下载地址:[url=/soft/11265.html]点击这儿下载[/url]
如点击地址不能下载,请这里下载:/soft/11265.html最近在做一个基于JAVA Servlet的WEB应用以及对应的Anroid应用客户端的开发工作。
其中,在接口的访问和数据的传输方面使用的比较多的是使用JSON对象来操作格式化数据:在服务器端采用JSON字符串来传递数据并在WEB前端或者Android客户端使用JSON来解析接收到的数据。
首先,在JAVA中使用JSON需要引入 org.json 包(点击
可以下载相应的JAR包!), 并在程序中引入相应的JSON类:
1 import org.json.JSONA
2 import org.json.JSONE
3 import org.json.JSONO
其次,在服务器端的Servlet类中,可以使用如下方法收集数据并生成相应的JSON字符串
1 //声明一个Hash对象并添加数据
2 Map params =
new HashMap();
4 params.put("username", username);
5 params.put("user_json", user);
7 //声明JSONArray对象并输入JSON字符串
8 JSONArray array = JSONArray.fromObject(params);
9 put.println(array.toString());
在WEB前端可以通过javascript直接对JSON字符串进行解析,在Android客户端的话,需要使用JSON类来解析字符串:
1 //@description: 根据接收到的JSON字符串来解析字符串中所包含的数据和数据对象
3 //接收到的JSON字符串
4 String result = "[{\"username\": \"your name\", \"user_json\": {\"username\": \"your name\", \"nickname\": \"your nickname\"}}]";
6 //根据字符串生成JSON对象
7 JSONArray resultArray = new JSONArray(result);
8 JSONObject resultObj = resultArray.optJSONObject(0);
10 //获取数据项
11 String username = resultObj.getString("username");
13 //获取数据对象
14 JSONObject user = resultObj.getJSONObject("user_json");
15 String nickname = user.getString("nickname");
&其实,主要就是涉及到以下集中数据类型之间的转换:
1. String 转换为JSON对象
1 import org.json.JSONA
2 import org.json.JSONE
3 import org.json.JSONO
5 //别忘了添加上JSON包哦!
6 public class StringToJSON {
public static void main(String[] args) throws JSONException{
System.out.println("abc");
//定义JSON字符串
String jsonStr = "{\"id\": 2," +
" \"title\": \"json title\", " +
"\"config\": {" +
"\"width\": 34," +
"\"height\": 35," +
"}, \"data\": [" +
"\"JAVA\", \"JavaScript\", \"PHP\"" +
//转换成为JSONObject对象
JSONObject jsonObj = new JSONObject(jsonStr);
//从JSONObject对象中获取数据
JavaBean bean = new JavaBean();
//根据属性名称获取int型数据;
bean.setId(jsonObj.getInt("id"));
//根据属性名获取String数据;
bean.setTitle(jsonObj.getString("title"));
//根据属性名获取JSONObject类
JSONObject config = jsonObj.getJSONObject("config");
bean.setWidth(config.getInt("width"));
bean.setHeight(config.getInt("height"));
//根据属性名获取JSONArray数组
JSONArray data = jsonObj.getJSONArray("data");
for(int index = 0, length = data.length(); index & index++) {
//这里在org.json.JSONArray对象中居然没有找到toArray方法,求各位网友给出解决办法啊!
bean.setLanguages(String[]);
46 class JavaBean{
private int
private int
private int
private String[]
//这里省略了设置器和访问器
2. JSON对象转换为String字符串
1 public static void main(String[] args) throws JSONException {
//创建JSONObject对象
JSONObject json = new JSONObject();
//向json中添加数据
json.put("username", "wanglihong");
json.put("height", 12.5);
json.put("age", 24);
//创建JSONArray数组,并将json添加到数组
JSONArray array = new JSONArray();
array.put(json);
//转换为字符串
String jsonStr = array.toString();
System.out.println(jsonStr);
最终输出结果为: [{"username":"wanglihong","height":12.5,"age":24}]&&
3. 集合转换为JSONArray对象
public static void main(String[] args)throws JSONException{
//初始化ArrayList集合并添加数据
List&String& list = new ArrayList&String&();
list.add("username");
list.add("age");
list.add("sex");
//初始化HashMap集合并添加数组
Map map = new HashMap();
map.put("bookname", "CSS3实战");
map.put("price", 69.0);
//初始化JSONArray对象,并添加数据
JSONArray array = new JSONArray();
array.put(list);
array.put(map);
//生成的JSON字符串为:[["username","age","sex"],{"price":69,"bookname":"CSS3实战"}]
阅读(...) 评论()

我要回帖

更多关于 particleillusion插件 的文章

 

随机推荐