[JSON_PROCESSING_SPEC-16] java bean direct to json string Created: 24/Oct/12  Updated: 25/Oct/12  Resolved: 25/Oct/12

Status: Closed
Project: json-processing-spec
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: wenshao Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

now jsonp only support:
json object -> json string
json string -> json object

it should support:
javabean -> json string
json string -> java bean

it's simple use, and good performance.

like fastjson's api:

com.alibaba.fastjson.JSON.toJSONString(Object)

demo:
https://github.com/AlibabaTech/fastjson/blob/master/src/test/java/com/alibaba/json/demo/Demo2.java



 Comments   
Comment by wenshao [ 24/Oct/12 ]

json string -> java bean :

VO vo = JSON.parseObject("...json string...", VO.class);

Comment by wenshao [ 24/Oct/12 ]

in the china, fastjson is very popular. it's really fast.

https://github.com/eishay/jvm-serializers/wiki/Staging-Results

6 times performance to gson, 2 times performance to jackson, 50 times performance to json-lib.

it's simple to use:
String jsonString = JSON.toJSONString(javaBean);
VO vo = JSON.parseObject("...json string ...", VO.class);

Comment by jitu [ 24/Oct/12 ]

This is outside of the current JSR scope. There will be JSON-Binding JSR that would address this usecase

Comment by jitu [ 25/Oct/12 ]

Resolving this one as this is outside the JSR scope

Generated at Fri Jul 31 01:40:10 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.