100+ results for 'com.alibaba.fast json'
Not the results you expected?
InboxService.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 236 lines
3 import com.alibaba.fastjson.JSON;
4 import com.linbox.im.message.UnreadMsg;
48 String redisKey = RedisKey.getInboxKey(id);
49 String json = JSON.toJSONString(msg);
76 if (newUnreadMsg == null) {
77 logger.error("The message is stale. Message in redis: {}. Message received: {}", JSON.toJSONString(oldUnreadMsg), JSON.toJSONString(msg));
78 return;
81 jedis.hset(redisKey, field, JSON.toJSONString(newUnreadMsg));
82 }
116 msg.count = msg.msgId - msgId;
117 jedis.hset(redisKey, field, JSON.toJSONString(msg));
118 }
DeserializeBeanInfo.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 357 lines
13 import com.alibaba.fastjson.JSONException;
14 import com.alibaba.fastjson.annotation.JSONCreator;
15 import com.alibaba.fastjson.annotation.JSONField;
186 JSONField annotation = method.getAnnotation(JSONField.class);
344 JSONCreator annotation = method.getAnnotation(JSONCreator.class);
345 if (annotation != null) {
346 if (factoryMethod != null) {
347 throw new JSONException("multi-json creator");
348 }
FilterUtils.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 297 lines
1 package com.alibaba.fastjson.serializer;
7 public static Object processValue(JSONSerializer serializer, Object object, String key, Object propertyValue) {
8 List<ValueFilter> valueFilters = serializer.getValueFiltersDirect();
18 public static String processKey(JSONSerializer serializer, Object object, String key, Object propertyValue) {
19 List<NameFilter> nameFilters = serializer.getNameFiltersDirect();
29 public static String processKey(JSONSerializer serializer, Object object, String key, byte intValue) {
30 List<NameFilter> nameFilters = serializer.getNameFiltersDirect();
42 public static String processKey(JSONSerializer serializer, Object object, String key, short intValue) {
43 List<NameFilter> nameFilters = serializer.getNameFiltersDirect();
55 public static String processKey(JSONSerializer serializer, Object object, String key, int intValue) {
56 List<NameFilter> nameFilters = serializer.getNameFiltersDirect();
ArrayListStringDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 109 lines
1 package com.alibaba.fastjson.parser.deserializer;
10 import com.alibaba.fastjson.JSONException;
11 import com.alibaba.fastjson.parser.DefaultJSONParser;
12 import com.alibaba.fastjson.parser.Feature;
13 import com.alibaba.fastjson.parser.JSONLexer;
14 import com.alibaba.fastjson.parser.JSONToken;
23 final JSONLexer lexer = parser.getLexer();
24 if (lexer.token() == JSONToken.NULL) {
25 lexer.nextToken(JSONToken.COMMA);
55 if (lexer.token() == JSONToken.NULL) {
56 lexer.nextToken(JSONToken.COMMA);
64 if (lexer.token() != JSONToken.LBRACKET) {
65 throw new JSONException("exepct '[', but " + lexer.token());
PullOldMsgHandler.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 179 lines
3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONObject;
5 import com.linbox.im.exceptions.IMConsumerException;
52 logger.debug("start handling PullOldMsgRequest: {}", json);
53 MessageWrapper wrapper = JSON.parseObject(json, MessageWrapper.class);
55 PullOldMsgRequest request = JSON.parseObject(((JSONObject)wrapper.content).toJSONString(), PullOldMsgRequest.class);
56 wrapper.content = request;
69 if (StringUtils.isBlank(userId)) {
70 logger.error("Can not find avaiable user id for PullOldMsgRequest {}", json);
71 return;
88 if (StringUtils.isBlank(remoteId)) {
89 logger.error("Can not find corresponding remote id for PullOldMsgRequest: {}", json);
ProducerImpl.java (https://gitlab.com/tanxinzheng/activemq-api) Java · 125 lines
MetricTimerTask.java (https://gitlab.com/zhengdingke/gmonitor) Java · 107 lines
SendMsgHandler.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 207 lines
3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONObject;
5 import com.linbox.im.exceptions.IMConsumerException;
103 logger.debug("Save SessionMessageDao into DB. Message: {}. Dao: {}", JSON.toJSONString(body), JSON.toJSONString(dao));
107 } else {
108 logger.debug("Find existing SessionMessageDao for message: {}. Dao: {}", JSON.toJSONString(body), JSON.toJSONString(dao));
109 }
136 logger.debug("Save GroupMessageDao into DB. Message: {}. Dao: {}", JSON.toJSONString(groupMsgBody), JSON.toJSONString(groupMsgDao));
140 } else {
141 logger.debug("Find existing GroupMessageDao for message: {}. Dao: {}", JSON.toJSONString(groupMsgBody), JSON.toJSONString(groupMsgDao));
142 }
FastJsonSerializationTest.java (https://gitlab.com/sxyseo/dubbox) Java · 266 lines
28 import com.alibaba.dubbo.common.serialize.support.json.FastJsonSerialization;
29 import com.alibaba.fastjson.JSONException;
49 @Ignore("FastJson bug: com.alibaba.fastjson.JSONException: create asm serilizer error, class char")
50 @Test
53 @Ignore("FastJson bug: com.alibaba.fastjson.JSONException: create asm serilizer error, class char")
54 @Test
151 @Ignore("FastJson bug: com.alibaba.fastjson.JSONException: illegal identifier : 1")
152 @Test
250 @Ignore("FastJson bug: com.alibaba.fastjson.JSONException: illegal identifier : 1")
251 @Test
FastjsonDataFormat.java (https://gitlab.com/matticala/apache-camel) Java · 188 lines
24 import com.alibaba.fastjson.JSON;
25 import com.alibaba.fastjson.serializer.SerializerFeature;
26 import com.alibaba.fastjson.support.config.FastJsonConfig;
27 import org.apache.camel.Exchange;
34 * A <a href="http://camel.apache.org/data-format.html">data format</a> ({@link DataFormat})
35 * using <a href="https://github.com/alibaba/fastjson">Fastjson</a> to marshal to and from JSON.
36 */
55 public FastjsonDataFormat(FastJsonConfig config, Class<?> unmarshalType) {
56 this.config = config;
177 /**
178 * If enabled then JSON will set the Content-Type header to <tt>application/json</tt> when marshalling.
179 */
HttpRequest.java (https://gitlab.com/GavinGJ/MATIRX) Java · 137 lines
JsonUserType.java (https://gitlab.com/0072016/es) Java · 144 lines
8 import com.alibaba.fastjson.JSONObject;
9 import com.alibaba.fastjson.serializer.SerializerFeature;
26 */
27 public class JsonUserType implements UserType, Serializable {
76 return JSONObject.parse(valueStr);
77 }
88 } else {
89 valueStr = JSONObject.toJSONString(value, SerializerFeature.WriteClassName);
90 }
112 if (o == null) return null;
113 String jsonStr = JSONObject.toJSONString(o, SerializerFeature.WriteClassName);
114 return JSONObject.parse(jsonStr);
ObjectUtil.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 152 lines
18 import com.alibaba.fastjson.JSON;
19 import com.alibaba.fastjson.JSONArray;
20 import com.alibaba.fastjson.JSONObject;
79 }
80 List<JSONObject> jsonObjectList = JSON.toJavaObject(
81 jsonParamsValues.getJSONArray(paramName), List.class);
103 }
104 JSONObject jsonObject = jsonParamsValues.getJSONObject(paramName);
105 return JSON.toJavaObject(jsonObject, clazz);
108 String paramName, JSONObject jsonParamsValues,ServiceRequest request){
109 JSONArray jsonArray = jsonParamsValues.containsKey(paramName) ? jsonParamsValues.getJSONArray(paramName) : null;
110 String paramTypeName = clazz.getComponentType().getName();
EnumDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 82 lines
1 package com.alibaba.fastjson.parser.deserializer;
8 import com.alibaba.fastjson.JSONException;
9 import com.alibaba.fastjson.parser.DefaultJSONParser;
10 import com.alibaba.fastjson.parser.JSONLexer;
11 import com.alibaba.fastjson.parser.JSONToken;
32 } catch (Exception ex) {
33 throw new JSONException("init enum values error, " + enumClass.getName());
34 }
41 final JSONLexer lexer = parser.getLexer();
42 if (lexer.token() == JSONToken.LITERAL_INT) {
43 value = lexer.intValue();
52 String strVal = lexer.stringVal();
53 lexer.nextToken(JSONToken.COMMA);
JavaBeanSerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 207 lines
15 */
16 package com.alibaba.fastjson.serializer;
27 import com.alibaba.fastjson.JSONException;
28 import com.alibaba.fastjson.util.FieldInfo;
29 import com.alibaba.fastjson.util.TypeUtils;
84 protected boolean isWriteClassName(JSONSerializer serializer, Object obj, Type fieldType, Object fieldName) {
85 return serializer.isWriteClassName(fieldType, obj);
88 public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {
89 SerializeWriter out = serializer.getWriter();
MetricsJson.java (https://gitlab.com/zhengdingke/gmonitor) Java · 162 lines
12 import com.alibaba.fastjson.JSON;
13 import com.alibaba.fastjson.JSONArray;
14 import com.alibaba.fastjson.JSONObject;
15 import com.google.common.collect.Lists;
119 JSONArray servers = new JSONArray();
120 servers.add(server);
134 cinfo.getModule().stream().forEach(m -> {
135 JSONObject moduleObj = createJsonObject(cinfo.getGmondConn(), serviceType, m);
136 String jsonFileName = m.getName() + ".json";
137 boolean over = StringFileTransUtil.string2File(JSON.toJSONString(moduleObj, true), new File(dir + "/test/" + jsonFileName));
138 LOG.info("createFile:" + dir + ":" + jsonFileName + ":" + (over ? "success" : "false"));
TimeDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 73 lines
1 package com.alibaba.fastjson.parser.deserializer;
5 import com.alibaba.fastjson.JSONException;
6 import com.alibaba.fastjson.parser.DefaultJSONParser;
7 import com.alibaba.fastjson.parser.JSONScanner;
8 import com.alibaba.fastjson.parser.JSONToken;
15 public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
16 JSONScanner lexer = (JSONScanner) parser.getLexer();
21 if (lexer.token() != JSONToken.LITERAL_STRING) {
22 throw new JSONException("syntax error");
23 }
57 long longVal;
58 JSONScanner dateLexer = new JSONScanner(strVal);
59 if (dateLexer.scanISO8601DateIfMatch()) {
FontDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 88 lines
1 package com.alibaba.fastjson.parser.deserializer;
8 import com.alibaba.fastjson.JSONException;
9 import com.alibaba.fastjson.parser.DefaultJSONParser;
10 import com.alibaba.fastjson.parser.JSONScanner;
11 import com.alibaba.fastjson.parser.JSONToken;
18 public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
19 JSONScanner lexer = (JSONScanner) parser.getLexer();
26 if (lexer.token() != JSONToken.LBRACE && lexer.token() != JSONToken.COMMA) {
27 throw new JSONException("syntax error");
39 String key;
40 if (lexer.token() == JSONToken.LITERAL_STRING) {
41 key = lexer.stringVal();
JSONWriter.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 151 lines
1 package com.alibaba.fastjson;
6 import com.alibaba.fastjson.serializer.JSONSerializer;
7 import com.alibaba.fastjson.serializer.SerializeWriter;
9 public class JSONWriter {
14 private JSONSerializer serializer;
51 public JSONWriter(Writer out){
52 this.out = out;
53 writer = new SerializeWriter();
54 serializer = new JSONSerializer(writer);
55 }
SyncUnreadHandler.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 177 lines
3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONObject;
5 import com.linbox.im.exceptions.IMConsumerException;
46 MessageWrapper wrapper = JSON.parseObject(json, MessageWrapper.class);
48 SyncUnreadRequest request = JSON.parseObject(((JSONObject)wrapper.content).toJSONString(), SyncUnreadRequest.class);
49 wrapper.content = request;
51 if(request == null) {
52 logger.error("SyncUnreadRequest format is not correct. Json string: {}", json);
53 return;
90 if (StringUtils.isBlank(remoteId)) {
91 logger.error("Can not find remote id for SyncUnreadRequest {}", json);
92 throw new IMException("Non existing SyncUnreadRequest " + json);
MapDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 129 lines
1 package com.alibaba.fastjson.parser.deserializer;
16 import com.alibaba.fastjson.JSONException;
17 import com.alibaba.fastjson.parser.DefaultJSONParser;
18 import com.alibaba.fastjson.parser.JSONLexer;
19 import com.alibaba.fastjson.parser.JSONToken;
20 import com.alibaba.fastjson.parser.ParseContext;
21 import com.alibaba.fastjson.util.AntiCollisionHashMap;
28 public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
29 final JSONLexer lexer = parser.getLexer();
30 if (lexer.token() == JSONToken.NULL) {
31 lexer.nextToken(JSONToken.COMMA);
32 return null;
ThrowableDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 163 lines
1 package com.alibaba.fastjson.parser.deserializer;
8 import com.alibaba.fastjson.JSONException;
9 import com.alibaba.fastjson.parser.DefaultJSONParser;
10 import com.alibaba.fastjson.parser.Feature;
11 import com.alibaba.fastjson.parser.JSONScanner;
12 import com.alibaba.fastjson.parser.JSONToken;
13 import com.alibaba.fastjson.parser.ParserConfig;
14 import com.alibaba.fastjson.util.TypeUtils;
23 public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
24 JSONScanner lexer = (JSONScanner) parser.getLexer();
52 if (key == null) {
53 if (lexer.token() == JSONToken.RBRACE) {
54 lexer.nextToken(JSONToken.COMMA);
IMMessageDecoder.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 123 lines
3 import com.alibaba.fastjson.JSON;
4 import com.linbox.im.message.MessageWrapper;
89 String json = aes.decrypt(buf);
91 Object message = JSON.parseObject(json, requestResponseType.getClazz());
93 if (message == null) {
94 logger.error("Can not parse message content from json string. Message Type: {}. Message Content Size: {}. Message Content: {}.", requestResponseType.getName());
95 } else {
TestModelClass.java (https://gitlab.com/zhengdingke/gmonitor) Java · 61 lines
9 import com.alibaba.fastjson.JSON;
10 import com.zdingke.gmonitor.common.StringFileTransUtil;
19 @Test
20 public void generateComponentJsonFile() {
21 MetricInfo minfo = new MetricInfo("memory", Arrays.asList(new String[]{"memory1","memory2"}),"memory");
23 ComponentInfo cinfo = new ComponentInfo("storm", Arrays.asList(moinfo), "1.1.1.1:1111");
24 StringFileTransUtil.string2File(JSON.toJSONString(cinfo, true), new File(TestModelClass.class.getResource("/").getFile().toString() + "storm.json"));
25 }
32 jinfo.setMetrics(Arrays.asList(minfo));
33 StringFileTransUtil.string2File(JSON.toJSONString(jinfo, true), new File(TestModelClass.class.getResource("/").getFile().toString() + "jvm.json"));
34 }
37 public void combineJvm() {
38 String jvm = StringFileTransUtil.file2String(new File(TestModelClass.class.getResource("/").getFile().toString() + "jvm.json"), "GBK");
39 JVMInfo jinfo = JSON.parseObject(jvm, JVMInfo.class);
IOUtils.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 208 lines
JSONArray.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 368 lines
19 import static com.alibaba.fastjson.util.TypeUtils.castToBigInteger;
20 import static com.alibaba.fastjson.util.TypeUtils.castToBoolean;
21 import static com.alibaba.fastjson.util.TypeUtils.castToByte;
22 import static com.alibaba.fastjson.util.TypeUtils.castToDate;
23 import static com.alibaba.fastjson.util.TypeUtils.castToDouble;
26 import static com.alibaba.fastjson.util.TypeUtils.castToLong;
27 import static com.alibaba.fastjson.util.TypeUtils.castToShort;
28 import static com.alibaba.fastjson.util.TypeUtils.castToSqlDate;
43 import com.alibaba.fastjson.util.TypeUtils;
47 */
48 public class JSONArray extends JSON implements List<Object>, JSONAware, Cloneable, RandomAccess, Serializable {
IdentityHashMap.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 96 lines
DispatchToSingleHandler.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 161 lines
3 import com.alibaba.fastjson.JSON;
4 import com.linbox.im.exceptions.IMConsumerException;
38 public void handle(ConsumerRecord<String, String> record) {
39 String json = record.value();
41 try {
42 SendDispatchMessage dispatchMsg = JSON.parseObject(json, SendDispatchMessage.class);
43 if (dispatchMsg == null) {
44 throw new IMException("DispatchMessage could not be parsed correctly. Message: " + json);
45 }
59 } catch (Exception e) {
60 throw new IMConsumerException(e, json);
61 }
JsonHttpMessageConverter.java (https://gitlab.com/Fish-Potato/TTStreet-core) Java · 83 lines
3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.serializer.SerializerFeature;
5 import com.tts.util.JsonUtil;
6 import org.springframework.http.HttpInputMessage;
24 @Service
25 public class JsonHttpMessageConverter extends AbstractHttpMessageConverter<Object> {
26 public static final Charset UTF8 = Charset.forName("UTF-8");
30 public JsonHttpMessageConverter() {
31 super(new MediaType[]{new MediaType("application", "json", UTF8), new MediaType("application", "*+json", UTF8)});
32 this.charset = UTF8;
78 String text = JSON.toJSONString(obj, this.features);
79 byte[] bytes = text.getBytes(this.charset);
Parsers.java (https://gitlab.com/achmadalam.xirpl6/RamalanCuacaBukaan) Java · 129 lines
7 import com.alibaba.fastjson.JSON;
99 //DESERIALISASI JSON DATA RAMALAN CUACA PER HARI
100 public CuacaPerHari parseJSONCuacaHarian(String stringJson) {
104 try {
105 cuacaPerHari = JSON.parseObject(stringJson, CuacaPerHari.class);
106 } catch (Exception e) {
114 //DESERIALISASI JSON DATA RAMALAN CUACA PER JAM
115 public CuacaPerJams parseJSONCuacaPerJAM(String stringJSON) {
119 try {
120 cuacaPerJams = JSON.parseObject(stringJSON, CuacaPerJams.class);
121 } catch (Exception e) {
RectangleDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 81 lines
1 package com.alibaba.fastjson.parser.deserializer;
8 import com.alibaba.fastjson.JSONException;
9 import com.alibaba.fastjson.parser.DefaultJSONParser;
10 import com.alibaba.fastjson.parser.JSONScanner;
11 import com.alibaba.fastjson.parser.JSONToken;
18 public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
19 JSONScanner lexer = (JSONScanner) parser.getLexer();
26 if (lexer.token() != JSONToken.LBRACE && lexer.token() != JSONToken.COMMA) {
27 throw new JSONException("syntax error");
32 for (;;) {
33 if (lexer.token() == JSONToken.RBRACE) {
34 lexer.nextToken();
AuthenticationEntryPointImpl.java (https://gitlab.com/mrsunchangemyselfsun/ruoyi-vue) Java · 34 lines
9 import org.springframework.stereotype.Component;
10 import com.alibaba.fastjson.JSON;
11 import com.ruoyi.common.constant.HttpStatus;
31 String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI());
32 ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg)));
33 }
DefaultExtJSONParser.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 42 lines
15 */
16 package com.alibaba.fastjson.parser;
22 @Deprecated
23 public class DefaultExtJSONParser extends DefaultJSONParser {
25 public DefaultExtJSONParser(String input){
26 this(input, ParserConfig.getGlobalInstance());
29 public DefaultExtJSONParser(String input, ParserConfig mapping){
30 super(input, mapping);
33 public DefaultExtJSONParser(String input, ParserConfig mapping, int features){
34 super(input, mapping, features);
DispatchToGroupHandler.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 67 lines
3 import com.alibaba.fastjson.JSON;
4 import com.linbox.im.exceptions.IMConsumerException;
37 public void handle(ConsumerRecord<String, String> record) {
38 String json = record.value();
40 try {
41 final Message groupMessage = JSON.parseObject(json, Message.class);
43 if (groupMessage == null) {
44 throw new IMException("Message could not be parsed correctly. Message: " + json);
45 }
63 } catch (Exception e) {
64 throw new IMConsumerException(e, json);
65 }
ArraySerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 84 lines
ByteArraySerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 43 lines
MapSerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 180 lines
ByteCreator.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 35 lines
User.java (https://bitbucket.org/leafiwan/collegemailsystem.git) Java · 338 lines
12 import org.apache.struts2.json.annotations.JSON;
14 import com.alibaba.fastjson.annotation.JSONField;
15 import com.jieshuhuiyou.Config;
127 @JSONField(serialize = false)
128 @JSON(serialize = false)
129 public String getDescription() {
155 @JSONField(serialize = false)
156 @JSON(serialize = false)
157 public String getPassword() {
175 @JSONField(serialize = false)
176 public int getSharingCount() {
Restful.java (https://gitlab.com/sxyseo/dubbox) Java · 92 lines
BigIntegerDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 41 lines
1 package com.alibaba.fastjson.parser.deserializer;
6 import com.alibaba.fastjson.parser.DefaultJSONParser;
7 import com.alibaba.fastjson.parser.JSONLexer;
8 import com.alibaba.fastjson.parser.JSONToken;
9 import com.alibaba.fastjson.util.TypeUtils;
15 @SuppressWarnings("unchecked")
16 public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
17 return (T) deserialze(parser);
20 @SuppressWarnings("unchecked")
21 public static <T> T deserialze(DefaultJSONParser parser) {
22 final JSONLexer lexer = parser.getLexer();
23 if (lexer.token() == JSONToken.LITERAL_INT) {
24 String val = lexer.numberString();
AtomicReferenceSerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 35 lines
IMMessageEncoder.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 45 lines
LoopQuery.scala (https://gitlab.com/coinmachine/ares) Scala · 198 lines
3 import com.alibaba.fastjson.{JSON, JSONObject}
4 import com.coinmachine.ares.Logging
15 try {
16 val pos = JSON.parse(user.futurePostV1.future_position(symbol, contractType)).asInstanceOf[JSONObject]
17 if (Option(pos).nonEmpty) {
57 try {
58 val orders = JSON.parse(user.stockPostV1.order_info(symbol, orderId)).asInstanceOf[JSONObject].getJSONArray("orders")
59 Option(orders) match {
81 try {
82 val orders = JSON.parse(user.futurePostV1.future_orders_info(symbol, contractType, orderId)).asInstanceOf[JSONObject].getJSONArray("orders")
83 Option(orders) match {
159 try {
160 val ticker = JSON.parse(user.futureGetV1.future_ticker(symbol, contractType)).asInstanceOf[JSONObject]
161 if (ticker.containsKey("ticker")) {
Message.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 75 lines
3 import com.alibaba.fastjson.annotation.JSONField;
4 import com.linbox.im.server.storage.entity.GroupMessageEntity;
12 // 消息发送时的 rId
13 @JSONField(name = "r_id")
14 public long rId;
16 // 发送方 id
17 @JSONField(name = "from_user_id")
18 public String fromUserId;
20 // 目的方 id
21 @JSONField(name = "to_user_id")
22 public String toUserId;
24 // 群组 id
25 @JSONField(name = "group_id")
26 public String groupId;
IntegerFieldDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 57 lines
1 package com.alibaba.fastjson.parser.deserializer;
6 import com.alibaba.fastjson.parser.DefaultJSONParser;
7 import com.alibaba.fastjson.parser.JSONLexer;
8 import com.alibaba.fastjson.parser.JSONToken;
9 import com.alibaba.fastjson.parser.ParserConfig;
10 import com.alibaba.fastjson.util.FieldInfo;
11 import com.alibaba.fastjson.util.TypeUtils;
19 @Override
20 public void parseField(DefaultJSONParser parser, Object object, Type objectType, Map<String, Object> fieldValues) {
21 Integer value;
23 final JSONLexer lexer = parser.getLexer();
24 if (lexer.token() == JSONToken.LITERAL_INT) {
ThreadLocalCache.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 117 lines
PingHandler.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 59 lines
3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONObject;
31 public void handle(ConsumerRecord<String, String> record) {
32 String json = record.value();
34 try {
35 logger.debug("Start handling Ping: {}", json);
37 MessageWrapper wrapper = JSON.parseObject(json, MessageWrapper.class);
39 Ping ping = JSON.parseObject(((JSONObject)wrapper.content).toJSONString(), Ping.class);
40 wrapper.content = ping;
SyncSystemUnreadHandler.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 110 lines
3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONObject;
45 MessageWrapper wrapper = JSON.parseObject(json, MessageWrapper.class);
47 SyncSystemUnreadRequest request = JSON.parseObject(((JSONObject)wrapper.content).toJSONString(), SyncSystemUnreadRequest.class);
48 wrapper.content = request;
50 if (request == null) {
51 logger.error("SyncSystemUnreadCallback format is not correct. Json string: {}", json);
52 return;
66 newFriends.systemType = SystemMessageTypes.NewFriend.getValue();
67 newFriends.content = JSON.toJSONString(newFriendsContent);
68 messages.add(newFriends);
TTSRedisTemplate.java (https://gitlab.com/Fish-Potato/TTStreet-core) Java · 113 lines
SameUrlDataInterceptor.java (https://gitlab.com/mrsunchangemyselfsun/ruoyi-vue) Java · 110 lines
Feature.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 106 lines
JsonFilePageModelPipeline.java (https://gitlab.com/taichu/webmagic) Java · 56 lines
3 import com.alibaba.fastjson.JSON;
4 import org.apache.commons.codec.digest.DigestUtils;
16 /**
17 * Store results objects (page models) to files in JSON format.<br>
18 * Use model.getKey() as file name if the model implements HasKey.<br>
23 */
24 public class JsonFilePageModelPipeline extends FilePersistentBase implements PageModelPipeline {
28 /**
29 * new JsonFilePageModelPipeline with default path "/data/webmagic/"
30 */
49 PrintWriter printWriter = new PrintWriter(new FileWriter(getFile(filename)));
50 printWriter.write(JSON.toJSONString(o));
51 printWriter.close();
CollectionDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 70 lines
1 package com.alibaba.fastjson.parser.deserializer;
11 import com.alibaba.fastjson.JSONException;
12 import com.alibaba.fastjson.parser.DefaultJSONParser;
13 import com.alibaba.fastjson.parser.JSONToken;
19 @SuppressWarnings({ "unchecked", "rawtypes" })
20 public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
21 if (parser.getLexer().token() == JSONToken.NULL) {
22 parser.getLexer().nextToken(JSONToken.COMMA);
23 return null;
40 } catch (Exception e) {
41 throw new JSONException("create instane error, class " + rawClass.getName());
42 }
IMService.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 137 lines
DoubleSerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 58 lines
SerializeConfig.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 175 lines
15 */
16 package com.alibaba.fastjson.serializer;
43 import com.alibaba.fastjson.JSONException;
44 import com.alibaba.fastjson.annotation.JSONType;
45 import com.alibaba.fastjson.util.ASMUtils;
46 import com.alibaba.fastjson.util.IdentityHashMap;
76 {
77 JSONType annotation = clazz.getAnnotation(JSONType.class);
78 if (annotation != null && annotation.asm() == false) {
89 } catch (Throwable e) {
90 throw new JSONException("create asm serializer error, class " + clazz, e);
91 }
ConsumerImpl.java (https://gitlab.com/tanxinzheng/activemq-api) Java · 77 lines
3 import com.alibaba.fastjson.JSONObject;
4 import org.apache.activemq.command.ActiveMQQueue;
56 consumeResult.setRequestId(requestId);
57 TextMessage responseMessage = session.createTextMessage(JSONObject.toJSONString(consumeResult));
58 responseMessage.setStringProperty(BaseMessage.MESSAGE_ID, messageId);
IMMessageHandler.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 138 lines
3 import com.alibaba.fastjson.JSON;
4 import com.linbox.im.message.*;
61 String json = JSON.toJSONString(wrapper);
72 kafkaProducer.send(new ProducerRecord<String, String>(MessageTopic.TOPIC_SYNC_UNREAD, json));
73 break;
92 kafkaProducer.send(new ProducerRecord<String, String>(MessageTopic.TOPIC_PULL_OLD_MEG, json));
93 break;
125 default:
126 logger.error("{} is not handled right now. Message content: {}", type.getName(), JSON.toJSONString(msg));
127 }
JobProcessLog.java (https://gitlab.com/zhengdingke/htest) Java · 59 lines
FastJsonObjectInput.java (https://gitlab.com/sxyseo/dubbox) Java · 138 lines
15 */
16 package com.alibaba.dubbo.common.serialize.support.json;
27 import com.alibaba.dubbo.common.utils.PojoUtils;
28 import com.alibaba.fastjson.JSON;
30 /**
31 * JsonObjectInput
32 *
116 String json = readLine();
117 return JSON.parse(json);
118 }
121 String json = readLine();
122 return JSON.parseObject(json, cls);
123 }
SyncUnreadRequest.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 39 lines
3 import com.alibaba.fastjson.annotation.JSONField;
9 // request id
10 @JSONField(name="r_id")
11 public long rId;
13 // user chat id
14 @JSONField(name="user_id")
15 public String userId;
18 // 非必填项,填写则指定拉取一组对话的未读数信息。不填则拉取所有未读数信息
19 @JSONField(name = "remote_id")
20 public String remoteId;
22 @JSONField(name = "group_id")
23 public String groupId;
LogUtils.java (https://gitlab.com/0072016/es) Java · 150 lines
GangliaWriter.java (https://gitlab.com/zhengdingke/gmonitor) Java · 309 lines
16 import com.alibaba.fastjson.JSON;
17 import com.alibaba.fastjson.annotation.JSONCreator;
59 @JSONCreator
60 public GangliaWriter(String host, Integer port, String addressingMode, Integer ttl, Boolean v31, String units, String slope, Integer tmax, Integer dmax,
225 public String toString() {
226 return JSON.toJSONString(this, true);
227 }
FastJson2JsonRedisSerializer.java (https://gitlab.com/mrsunchangemyselfsun/ruoyi-vue) Java · 71 lines
3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.serializer.SerializerFeature;
9 import org.springframework.data.redis.serializer.SerializationException;
10 import com.alibaba.fastjson.parser.ParserConfig;
11 import org.springframework.util.Assert;
18 */
19 public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
20 {
33 public FastJson2JsonRedisSerializer(Class<T> clazz)
34 {
45 }
46 return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(DEFAULT_CHARSET);
47 }
ObjectFieldSerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 120 lines
15 */
16 package com.alibaba.fastjson.serializer;
20 import com.alibaba.fastjson.annotation.JSONField;
21 import com.alibaba.fastjson.util.FieldInfo;
41 JSONField annotation = fieldInfo.getAnnotation(JSONField.class);
66 @Override
67 public void writeProperty(JSONSerializer serializer, Object propertyValue) throws Exception {
68 writePrefix(serializer);
JsonUtil.java (https://gitlab.com/Fish-Potato/TTStreet-core) Java · 80 lines
3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONObject;
5 import com.alibaba.fastjson.parser.Feature;
6 import com.alibaba.fastjson.parser.ParserConfig;
7 import com.alibaba.fastjson.parser.deserializer.ParseProcess;
23 }
24 return JSON.toJSONString(o);
25 }
72 T t = null;
73 JSONObject jsonObject =(JSONObject) JSON.parse(param);
74 return (T)jsonObject.get(jsonObject.keySet().iterator().next());
EnumerationSeriliazer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 75 lines
JsonFilePipeline.java (https://gitlab.com/taichu/webmagic) Java · 47 lines
3 import com.alibaba.fastjson.JSON;
4 import org.apache.commons.codec.digest.DigestUtils;
15 /**
16 * Store results to files in JSON format.<br>
17 *
20 */
21 public class JsonFilePipeline extends FilePersistentBase implements Pipeline {
25 /**
26 * new JsonFilePageModelPipeline with default path "/data/webmagic/"
27 */
40 PrintWriter printWriter = new PrintWriter(new FileWriter(getFile(path + DigestUtils.md5Hex(resultItems.getRequest().getUrl()) + ".json")));
41 printWriter.write(JSON.toJSONString(resultItems.getAll()));
42 printWriter.close();
ProducerClient.java (https://gitlab.com/tanxinzheng/activemq-api) Java · 48 lines
3 import com.alibaba.fastjson.JSONObject;
4 import com.udfex.ucs.amq.api.*;
30 dataMessage.setTopic("GUEST.PID_UDFEX_PRODUCER_TEST_00002");
31 dataMessage.setMessageBody(JSONObject.toJSONString(data));
32 producer.send(dataMessage);
45 data2.setName("测试队列2");
46 //producer2.send(JSONObject.toJSONString(data2));
47 }
ConsumerClient.java (https://gitlab.com/tanxinzheng/activemq-api) Java · 54 lines
3 import com.alibaba.fastjson.JSONObject;
4 import com.udfex.ucs.amq.api.*;
25 public MockData fromMessage(DataMessage dataMessage) {
26 return JSONObject.parseObject(dataMessage.getMessageBody(), MockData.class);
27 }
30 public void handler(MockData message) {
31 System.out.println("消费,GUEST.PID_UDFEX_PRODUCER_TEST_00001:" + JSONObject.toJSONString(message));
32 if(message.getAge() %2 ==0){
43 public MockData2 fromMessage(DataMessage dataMessage) {
44 return JSONObject.parseObject(dataMessage.getMessageBody(), MockData2.class);
45 }
ASMJavaBeanDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 100 lines
1 package com.alibaba.fastjson.parser.deserializer;
6 import com.alibaba.fastjson.JSONException;
7 import com.alibaba.fastjson.parser.DefaultJSONParser;
8 import com.alibaba.fastjson.parser.Feature;
9 import com.alibaba.fastjson.parser.JSONScanner;
10 import com.alibaba.fastjson.parser.ParserConfig;
11 import com.alibaba.fastjson.util.FieldInfo;
23 public abstract Object createInstance(DefaultJSONParser parser, Type type);
54 public boolean parseField(DefaultJSONParser parser, String key, Object object, Type objectType, Map<String, Object> fieldValues) {
55 JSONScanner lexer = (JSONScanner) parser.getLexer(); // xxx
DateSerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 124 lines
ReadAckHandler.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 133 lines
3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONObject;
5 import com.linbox.im.exceptions.IMConsumerException;
40 try {
41 logger.debug("Start handling ReadAckRequest: {}", json);
43 MessageWrapper wrapper = JSON.parseObject(json, MessageWrapper.class);
45 ReadAckRequest request = JSON.parseObject(((JSONObject)wrapper.content).toJSONString(), ReadAckRequest.class);
46 wrapper.content = request;
66 if (StringUtils.isBlank(remoteId)) {
67 logger.error("Can not find remote id for ReadAckRequest {}", json);
IMMessage.java (https://gitlab.com/qt-prometheus/qt-prometheus.git) Java · 275 lines
3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONArray;
5 import com.alibaba.fastjson.JSONObject;
48 {
49 JSONObject localJSONObject = new JSONObject();
50 try
116 public static boolean parseData(JSONObject paramJSONObject, IMMessage paramIMMessage)
117 {
151 {
152 JSONObject localJSONObject = (JSONObject)JSON.parse(paramString);
153 String str1 = localJSONObject.getString("msg");
267 {
268 return JSON.toJSONString(this);
269 }
NumberFieldSerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 49 lines
CharArrayDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 47 lines
1 package com.alibaba.fastjson.parser.deserializer;
5 import com.alibaba.fastjson.JSON;
6 import com.alibaba.fastjson.parser.DefaultJSONParser;
7 import com.alibaba.fastjson.parser.JSONLexer;
8 import com.alibaba.fastjson.parser.JSONToken;
19 @SuppressWarnings("unchecked")
20 public static <T> T deserialze(DefaultJSONParser parser) {
21 final JSONLexer lexer = parser.getLexer();
22 if (lexer.token() == JSONToken.LITERAL_STRING) {
23 String val = lexer.stringVal();
40 return (T) JSON.toJSONString(value).toCharArray();
41 }
BigDecimalDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 47 lines
1 package com.alibaba.fastjson.parser.deserializer;
6 import com.alibaba.fastjson.parser.DefaultJSONParser;
7 import com.alibaba.fastjson.parser.JSONLexer;
8 import com.alibaba.fastjson.parser.JSONToken;
9 import com.alibaba.fastjson.util.TypeUtils;
15 @SuppressWarnings("unchecked")
16 public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
17 return (T) deserialze(parser);
20 @SuppressWarnings("unchecked")
21 public static <T> T deserialze(DefaultJSONParser parser) {
22 final JSONLexer lexer = parser.getLexer();
23 if (lexer.token() == JSONToken.LITERAL_INT) {
24 long val = lexer.longValue();
SplashPresenter.java (https://gitlab.com/gzsll/TLint) Java · 89 lines
AbstractDateDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 99 lines
1 package com.alibaba.fastjson.parser.deserializer;
5 import com.alibaba.fastjson.JSONException;
6 import com.alibaba.fastjson.parser.DefaultJSONParser;
7 import com.alibaba.fastjson.parser.Feature;
8 import com.alibaba.fastjson.parser.JSONScanner;
9 import com.alibaba.fastjson.parser.JSONToken;
10 import com.alibaba.fastjson.util.TypeUtils;
15 public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
16 JSONScanner lexer = (JSONScanner) parser.getLexer();
27 if (lexer.isEnabled(Feature.AllowISO8601DateFormat)) {
28 JSONScanner iso8601Lexer = new JSONScanner(strVal);
29 if (iso8601Lexer.scanISO8601DateIfMatch()) {
TestStringFileTransUtil.java (https://gitlab.com/zhengdingke/gmonitor) Java · 31 lines
8 import com.alibaba.fastjson.JSON;
9 import com.zdingke.gmonitor.common.StringFileTransUtil;
15 String x = StringFileTransUtil.file2String(new File(TestStringFileTransUtil.class.getResource("/").getFile().toString() + "nimbus.json"), "GBK");
16 System.out.println(JSON.toJSON(x));
17 }
20 public void string2File() {
21 String x = StringFileTransUtil.file2String(new File(TestStringFileTransUtil.class.getResource("/").getFile().toString() + "nimbus.json"), "GBK");
22 StringFileTransUtil.string2File(x, new File(TestStringFileTransUtil.class.getResource("/").getFile().toString() + "nimbus1.json"));
ClassDerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 40 lines
1 package com.alibaba.fastjson.parser.deserializer;
5 import com.alibaba.fastjson.JSONException;
6 import com.alibaba.fastjson.parser.DefaultJSONParser;
7 import com.alibaba.fastjson.parser.JSONLexer;
8 import com.alibaba.fastjson.parser.JSONToken;
9 import com.alibaba.fastjson.util.TypeUtils;
18 @SuppressWarnings("unchecked")
19 public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
20 JSONLexer lexer = parser.getLexer();
22 if (lexer.token() == JSONToken.NULL) {
23 lexer.nextToken();
MetricJsonCreateUtil.java (https://gitlab.com/zhengdingke/gmonitor) Java · 116 lines
14 import com.alibaba.fastjson.JSON;
15 import com.alibaba.fastjson.JSONObject;
16 import com.google.common.collect.Lists;
72 String serviceType = info.getName().replace("-info.json", "");
73 MetricsJson metricJson = getMetricsJsonByServiceType(serviceType, dirpath);
74 ComponentInfo cinfo = null;
78 cinfo.getModule().stream().forEach(m -> {
79 jsonObj.add(metricJson.createJsonObject(gmondConn, serviceType, m));
80 });
90 List<JSONObject> jsonObj = Lists.newArrayList();
91 MetricsJson metricJson = getMetricsJsonByServiceType(serviceType, dirpath);
92 ComponentInfo cinfo = null;
96 cinfo.getModule().stream().forEach(m -> {
97 jsonObj.add(metricJson.createJsonObject(gmondConn, serviceType, m));
98 });
proguard-rules.pro (https://gitlab.com/tembem/RamalanCuacaBukaan) Prolog · 125 lines
SimpleTest.java (https://gitlab.com/iamshijun/spring_demo) Java · 78 lines
11 import com.alibaba.fastjson.JSON;
12 import com.alibaba.fastjson.JSONArray;
13 import com.alibaba.fastjson.JSONObject;
36 public void testFastJson(){
37 JSONArray jsonArray = JSON.parseArray("[{'itemId':1,'itemDetailId':2,'value':'long......text'},"
38 + "{'itemId':2,'value':''}"
40 for(int i = 0, size = jsonArray.size(); i < size ; ++i){
41 JSONObject jsonObject = jsonArray.getJSONObject(i);
42 Long itemId = jsonObject.getLong("itemId");
43 Long itemDetailId = jsonObject.getLong("itemDetailId");
44 String value = jsonObject.getString("value");
StringSerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 46 lines
15 */
16 package com.alibaba.fastjson.serializer;
28 public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {
29 write(serializer, (String) object);
32 public void write(JSONSerializer serializer, String value) {
33 SerializeWriter out = serializer.getWriter();
StackTraceElementDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 122 lines
1 package com.alibaba.fastjson.parser.deserializer;
5 import com.alibaba.fastjson.JSONException;
6 import com.alibaba.fastjson.parser.DefaultJSONParser;
7 import com.alibaba.fastjson.parser.Feature;
8 import com.alibaba.fastjson.parser.JSONLexer;
9 import com.alibaba.fastjson.parser.JSONToken;
23 if (lexer.token() != JSONToken.LBRACE && lexer.token() != JSONToken.COMMA) {
24 throw new JSONException("syntax error: " + JSONToken.name(lexer.token()));
62 } else {
63 throw new JSONException("syntax error");
64 }
75 lineNumber = 0;
76 } else if (lexer.token() == JSONToken.LITERAL_INT) {
77 lineNumber = lexer.intValue();
FieldSerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 97 lines
15 */
16 package com.alibaba.fastjson.serializer;
22 import com.alibaba.fastjson.annotation.JSONField;
23 import com.alibaba.fastjson.util.FieldInfo;
47 JSONField annotation = fieldInfo.getAnnotation(JSONField.class);
48 if (annotation != null) {
73 public void writePrefix(JSONSerializer serializer) throws IOException {
74 SerializeWriter out = serializer.getWriter();
95 public abstract void writeProperty(JSONSerializer serializer, Object propertyValue) throws Exception;
LocalServiceInvoker.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 120 lines
23 import com.alibaba.fastjson.JSON;
24 import com.alibaba.fastjson.JSONArray;
25 import com.alibaba.fastjson.JSONObject;
79 .getParameterNames(methodToCall);
80 JSONObject jsonParamsValues = serviceRequest.getParams();
81 Class<?>[] parameterTypes = methodToCall.getParameterTypes();
83 Object[] paramValues = new Object[parameterTypes.length];
84 logger.debug("jsonParamValues:" + jsonParamsValues);
85 for (int i = 0; i < parameterTypes.length; i++) {
88 Type type = types[i];
89 paramValues[i] = ObjectUtil.initValue(clazz, type, paramName, jsonParamsValues, serviceRequest);
90 }
ArrayListTypeFieldDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 131 lines
10 import com.alibaba.fastjson.JSONException;
11 import com.alibaba.fastjson.parser.DefaultJSONParser;
12 import com.alibaba.fastjson.parser.Feature;
13 import com.alibaba.fastjson.parser.JSONLexer;
14 import com.alibaba.fastjson.parser.JSONToken;
15 import com.alibaba.fastjson.parser.ParseContext;
16 import com.alibaba.fastjson.parser.ParserConfig;
17 import com.alibaba.fastjson.util.FieldInfo;
94 if (lexer.token() != JSONToken.LBRACKET) {
95 throw new JSONException("exepct '[', but " + JSONToken.name(lexer.token()));
96 }
AtomicLongArrayDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 35 lines
1 package com.alibaba.fastjson.parser.deserializer;
6 import com.alibaba.fastjson.JSONArray;
7 import com.alibaba.fastjson.parser.DefaultJSONParser;
8 import com.alibaba.fastjson.parser.JSONToken;
14 @SuppressWarnings("unchecked")
15 public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
16 if (parser.getLexer().token() == JSONToken.NULL) {
17 parser.getLexer().nextToken(JSONToken.COMMA);
18 return null;
21 JSONArray array = new JSONArray();
22 parser.parseArray(array);
InetSocketAddressDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 64 lines
1 package com.alibaba.fastjson.parser.deserializer;
7 import com.alibaba.fastjson.JSONException;
8 import com.alibaba.fastjson.parser.DefaultJSONParser;
9 import com.alibaba.fastjson.parser.JSONLexer;
10 import com.alibaba.fastjson.parser.JSONToken;
17 public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
18 JSONLexer lexer = parser.getLexer();
20 if (lexer.token() == JSONToken.NULL) {
21 lexer.nextToken();
25 parser.accept(JSONToken.LBRACE);
ServiceRequest.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 206 lines
12 import com.alibaba.fastjson.JSONObject;
54 /** 头信息. */
55 private JSONObject headers;
57 /** 应用参数. */
58 private JSONObject params;
71 public ServiceRequest(HttpServletRequest servletRequest, String fullServiceName, String service,
72 String method, JSONObject headers, JSONObject params,
73 boolean isMultiPart,Map<String,MultipartFile> fileMap) {
112 */
113 public JSONObject getHeaders() {
114 if(headers==null){
StrategyUtil.scala (https://gitlab.com/coinmachine/ares) Scala · 88 lines
3 import com.alibaba.fastjson.{JSON, JSONObject}
4 import com.coinmachine.ares.Logging
12 def config(): (UserInfo, String, Float, Float, Float) = {
13 val conf = new JSONObject()
35 val userInfoData = JSON.parse(userInfo.futurePostV1.future_userinfo()).asInstanceOf[JSONObject]
36 Option(userInfoData) match {
TestJson.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 56 lines
9 import com.alibaba.fastjson.JSON;
10 import com.alibaba.fastjson.JSONObject;
12 public class TestJson {
18 // list.add("一切");
19 // System.out.println(JSON.toJSONString(list));
20 List<CustomBean> beans = new ArrayList<CustomBean>();
33 //}
34 //System.out.println(JSON.toJSONString(beans, true));
35 String strs = JSON.toJSONString(beans);
36 System.out.println(strs);
37 // //List list = JSON.parseArray(strs, List.class);
38 // //System.out.println(list);
DynamicSubject.java (https://gitlab.com/JasonZheng150214/Jasyl) Java · 45 lines
NumberDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 91 lines
1 package com.alibaba.fastjson.parser.deserializer;
6 import com.alibaba.fastjson.parser.DefaultJSONParser;
7 import com.alibaba.fastjson.parser.JSONLexer;
8 import com.alibaba.fastjson.parser.JSONToken;
9 import com.alibaba.fastjson.util.TypeUtils;
16 public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
17 final JSONLexer lexer = parser.getLexer();
18 if (lexer.token() == JSONToken.LITERAL_INT) {
20 String val = lexer.numberString();
21 lexer.nextToken(JSONToken.COMMA);
22 return (T) Double.valueOf(Double.parseDouble(val));
25 long val = lexer.longValue();
26 lexer.nextToken(JSONToken.COMMA);
SendMsgResponse.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 39 lines
3 import com.alibaba.fastjson.annotation.JSONField;
8 public class SendMsgResponse extends ByteCreator {
9 @JSONField(name = "r_id")
10 public long rId;
12 @JSONField(name = "msg_r_id")
13 public long msgRId;
15 @JSONField(name = "user_id")
16 public String userId;
18 @JSONField(name = "remote_id")
19 public String remoteId;
GangliaSink.java (https://gitlab.com/zhengdingke/htest) Java · 58 lines
DefaultFieldDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 48 lines
1 package com.alibaba.fastjson.parser.deserializer;
6 import com.alibaba.fastjson.parser.DefaultJSONParser;
7 import com.alibaba.fastjson.parser.DefaultJSONParser.ResolveTask;
8 import com.alibaba.fastjson.parser.JSONToken;
9 import com.alibaba.fastjson.parser.ParserConfig;
10 import com.alibaba.fastjson.util.FieldInfo;
20 @Override
21 public void parseField(DefaultJSONParser parser, Object object, Type objectType, Map<String, Object> fieldValues) {
22 if (fieldValueDeserilizer == null) {
26 Object value = fieldValueDeserilizer.deserialze(parser, getFieldType(), fieldInfo.getName());
27 if (parser.getResolveStatus() == DefaultJSONParser.NeedToResolve) {
28 ResolveTask task = parser.getLastResolveTask();
AutowiredObjectSerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 26 lines
UserHelper.java (https://github.com/dawnsait/holywar.git) Java · 44 lines
JSONToken.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 117 lines
LocaleDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 36 lines
1 package com.alibaba.fastjson.parser.deserializer;
6 import com.alibaba.fastjson.parser.DefaultJSONParser;
7 import com.alibaba.fastjson.parser.JSONToken;
12 @SuppressWarnings("unchecked")
13 public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
14 String text = (String) parser.parse();
33 public int getFastMatchToken() {
34 return JSONToken.LITERAL_STRING;
35 }
InetSocketAddressSerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 33 lines
JSONException.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 36 lines
BooleanDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 55 lines
1 package com.alibaba.fastjson.parser.deserializer;
5 import com.alibaba.fastjson.parser.DefaultJSONParser;
6 import com.alibaba.fastjson.parser.JSONLexer;
7 import com.alibaba.fastjson.parser.JSONToken;
8 import com.alibaba.fastjson.util.TypeUtils;
13 @SuppressWarnings("unchecked")
14 public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
15 return (T) deserialze(parser);
18 @SuppressWarnings("unchecked")
19 public static <T> T deserialze(DefaultJSONParser parser) {
20 final JSONLexer lexer = parser.getLexer();
22 if (lexer.token() == JSONToken.TRUE) {
23 lexer.nextToken(JSONToken.COMMA);
SendDispatcher.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 60 lines
3 import com.alibaba.fastjson.JSON;
4 import com.linbox.im.exceptions.IMException;
35 String json = JSON.toJSONString(message);
36 if (json == null) {
37 throw new IMException("Message to user " + userId + "can not be parsed to json correctly.");
38 }
40 kafkaProducer.send(new ProducerRecord<String, String>(MessageTopic.TOPIC_DISPATCH_SEND_SINGLE, json));
41 } catch (Exception e) {
48 try {
49 String json = JSON.toJSONString(message);
50 if (json == null) {
TimestampDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 56 lines
1 package com.alibaba.fastjson.parser.deserializer;
9 import com.alibaba.fastjson.JSONException;
10 import com.alibaba.fastjson.parser.DefaultJSONParser;
11 import com.alibaba.fastjson.parser.JSONToken;
17 @SuppressWarnings("unchecked")
18 protected <T> T cast(DefaultJSONParser parser, Type clazz, Object fieldName, Object val) {
50 throw new JSONException("parse error");
51 }
53 public int getFastMatchToken() {
54 return JSONToken.LITERAL_INT;
55 }
SimplePropertyPreFilter.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 58 lines
JSONField.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 44 lines
RedisScheduler.java (https://gitlab.com/taichu/webmagic) Java · 128 lines
3 import com.alibaba.fastjson.JSON;
4 import org.apache.commons.codec.digest.DigestUtils;
68 String field = DigestUtils.shaHex(request.getUrl());
69 String value = JSON.toJSONString(request);
70 jedis.hset((ITEM_PREFIX + task.getUUID()), field, value);
88 if (bytes != null) {
89 Request o = JSON.parseObject(new String(bytes), Request.class);
90 return o;
GangliaSink.java (https://gitlab.com/zhengdingke/gmonitor) Java · 60 lines
FieldVisitor.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 45 lines
SqlDateDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 61 lines
1 package com.alibaba.fastjson.parser.deserializer;
8 import com.alibaba.fastjson.JSONException;
9 import com.alibaba.fastjson.parser.DefaultJSONParser;
10 import com.alibaba.fastjson.parser.JSONScanner;
11 import com.alibaba.fastjson.parser.JSONToken;
17 @SuppressWarnings("unchecked")
18 protected <T> T cast(DefaultJSONParser parser, Type clazz, Object fieldName, Object val) {
19 if (val == null) {
35 JSONScanner dateLexer = new JSONScanner(strVal);
36 if (dateLexer.scanISO8601DateIfMatch()) {
51 } else {
52 throw new JSONException("parse error : " + val);
53 }
JsonConverter.java (https://gitlab.com/BGCX261/zk-full-demo-git.git) Java · 229 lines
12 import com.alibaba.fastjson.JSON;
13 import com.alibaba.fastjson.JSONArray;
14 import com.alibaba.fastjson.JSONObject;
94 JSONObject origMap = (JSONObject) origObj;
95 JSONObject newMap = new JSONObject();
96 for (OutputSchemaInfo valueTypeInfo : typeInfo.getChildren()) {
221 String jsonS = IOUtils.toString(JsonConverter.class.getResource("test/s18.o"), "utf8");
222 Object json = JSON.parse(jsonS);
223 String xmlStr = IOUtils.toString(JsonConverter.class.getResource("test/s18.xml"), "utf8");
224 OutputSchemaInfo typeInfo = readOutputSchema(xmlStr);
225 JSONObject newJson = (JSONObject) convert(json, typeInfo);
226 System.out.println(JSON.toJSONString(newJson, true));
LongFieldDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 62 lines
1 package com.alibaba.fastjson.parser.deserializer;
6 import com.alibaba.fastjson.parser.DefaultJSONParser;
7 import com.alibaba.fastjson.parser.JSONLexer;
8 import com.alibaba.fastjson.parser.JSONToken;
9 import com.alibaba.fastjson.parser.ParserConfig;
10 import com.alibaba.fastjson.util.FieldInfo;
11 import com.alibaba.fastjson.util.TypeUtils;
23 @Override
24 public void parseField(DefaultJSONParser parser, Object object, Type objectType, Map<String, Object> fieldValues) {
25 Long value;
27 final JSONLexer lexer = parser.getLexer();
28 if (lexer.token() == JSONToken.LITERAL_INT) {
SerialWriterStringEncoder.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 75 lines
LoginUser.java (https://gitlab.com/mrsunchangemyselfsun/ruoyi-vue) Java · 266 lines
6 import org.springframework.security.core.userdetails.UserDetails;
7 import com.alibaba.fastjson.annotation.JSONField;
8 import com.ruoyi.common.core.domain.entity.SysUser;
122 @JSONField(serialize = false)
123 @Override
137 */
138 @JSONField(serialize = false)
139 @Override
149 */
150 @JSONField(serialize = false)
151 @Override
161 */
162 @JSONField(serialize = false)
163 @Override