Comments (8)
yes.
if your use code: https://github.com/AlibabaTech/fastjson/tree/1.1.22_android
------------------ 原始邮件 ------------------
发件人: "Timo Mika Gläßer"[email protected];
发送时间: 2012年10月25日(星期四) 凌晨2:22
收件人: "AlibabaTech/fastjson"[email protected];
主题: [fastjson] fastjson / android (#14)
can fastjson be made to work on android?
—
Reply to this email directly or view it on GitHub.
from fastjson.
sounds great... is there anything significant missing from that release? i think the last commit was a couple of months ago?
from fastjson.
for android, it's enough!
from fastjson.
太感谢了,膜拜。
from fastjson.
hey wenshao, i tried that... the library actually builds fine but the tests don't work... is that intended? or will i run into issues because it being buggy?
from fastjson.
Also just a note when I do something like this:
public class SplashActivity extends Activity {
class Hello {
public Hello() {
}
private String goodbye;
public String getGoodbye() {
return goodbye;
}
public void setGoodbye(String goodbye) {
this.goodbye = goodbye;
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
Log.d("TEST", "hello");
Hello hello = JSON.parseObject("{goodbye: \"abc\"}", Hello.class);
Log.d("TEST", hello.goodbye);
}
}
it fails with the following stacktrace.
11-06 11:22:01.653: E/AndroidRuntime(18719): FATAL EXCEPTION: main
11-06 11:22:01.653: E/AndroidRuntime(18719): com.alibaba.fastjson.JSONException: create instance error, class com.affinityclick.hush.views.activities.SplashActivity$Hello
11-06 11:22:01.653: E/AndroidRuntime(18719): at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.createInstance(JavaBeanDeserializer.java:104)
11-06 11:22:01.653: E/AndroidRuntime(18719): at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.deserialze(JavaBeanDeserializer.java:235)
11-06 11:22:01.653: E/AndroidRuntime(18719): at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:463)
11-06 11:22:01.653: E/AndroidRuntime(18719): at com.alibaba.fastjson.JSON.parseObject(JSON.java:206)
11-06 11:22:01.653: E/AndroidRuntime(18719): at com.alibaba.fastjson.JSON.parseObject(JSON.java:166)
11-06 11:22:01.653: E/AndroidRuntime(18719): at com.alibaba.fastjson.JSON.parseObject(JSON.java:287)
11-06 11:22:01.653: E/AndroidRuntime(18719): at com.affinityclick.hush.views.activities.SplashActivity$1.run(SplashActivity.java:57)
11-06 11:22:01.653: E/AndroidRuntime(18719): at android.os.Handler.handleCallback(Handler.java:615)
11-06 11:22:01.653: E/AndroidRuntime(18719): at android.os.Handler.dispatchMessage(Handler.java:92)
11-06 11:22:01.653: E/AndroidRuntime(18719): at android.os.Looper.loop(Looper.java:137)
11-06 11:22:01.653: E/AndroidRuntime(18719): at android.app.ActivityThread.main(ActivityThread.java:4745)
11-06 11:22:01.653: E/AndroidRuntime(18719): at java.lang.reflect.Method.invokeNative(Native Method)
11-06 11:22:01.653: E/AndroidRuntime(18719): at java.lang.reflect.Method.invoke(Method.java:511)
11-06 11:22:01.653: E/AndroidRuntime(18719): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-06 11:22:01.653: E/AndroidRuntime(18719): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-06 11:22:01.653: E/AndroidRuntime(18719): at dalvik.system.NativeStart.main(Native Method)
11-06 11:22:01.653: E/AndroidRuntime(18719): Caused by: java.lang.NullPointerException
11-06 11:22:01.653: E/AndroidRuntime(18719): at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.createInstance(JavaBeanDeserializer.java:101)
11-06 11:22:01.653: E/AndroidRuntime(18719): ... 15 more
When i make the inner-class "public static" it works again.
it also fails if i don't have an empty default constructor which is the way you show it your examples... but that's not a biggy.
from fastjson.
otherwise... pretty much everything seems to work.your library is awesome!
from fastjson.
public class SplashActivity extends Activity {
static class Hello { // none static inner class how create instance?
}
}
from fastjson.
Related Issues (20)
- Android中序列化Context、Activity、Fragment导致StackOverflowError
- com.alibaba.fastjson.JSONException: GC overhead limit exceeded
- With IgnoreErrorGetter & WriteClassName to serialize , the value of number (short、double) with precision letter
- FastJson 1.2.83存在未在黑名单内的JDK原生可利用类
- 日期少0反序列化报错 HOT 1
- 使用线程池序列化时,有概率会出现ref循环引用问题 HOT 1
- 对UTC时间,非三位小数点的毫秒解析错误
- 重复了 关
- 有关fastjson设计上的问题
- 高版本反序列化时不能识别字段名
- 使用 graalvm 构建可执行文件,执行后发生: No classes have been predefined during the image build to load from bytecodes at runtime.
- jdk 11 fastjson 1.2.83 报 java.net.http does not export jdk.internal.net.http to unnamed module @0x67ecfe55
- ObjectSerializer元数据空间溢出。只有一个SerializeConfig实例 HOT 2
- fastjson 版本支持问题
- FastJsonHttpMessageConverter自定义 Long类型的Deserializer不生效 HOT 1
- 1.2.83版本 long类型反序列化位数超出后会无感处理溢出
- 1.2.83 版本使用 JSON.parseObject 方法转换字符串时,会报OOM HOT 8
- 1.2.74 java.lang.ClassCastException: byte[] cannot be cast to int[]
- android14解析高德定位信息失败
- Version 1.2.83 failed to deserialize certain value when its ref path contains dash
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastjson.