100+ results for 'com.alibaba.fast json'

Not the results you expected?

InboxService.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 236 lines

2

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);

50

76 if (newUnreadMsg == null) {

77 logger.error("The message is stale. Message in redis: {}. Message received: {}", JSON.toJSONString(oldUnreadMsg), JSON.toJSONString(msg));

78 return;

80

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

12

13 import com.alibaba.fastjson.JSONException;

14 import com.alibaba.fastjson.annotation.JSONCreator;

15 import com.alibaba.fastjson.annotation.JSONField;

16

185

186 JSONField annotation = method.getAnnotation(JSONField.class);

187

343

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;

2

6

7 public static Object processValue(JSONSerializer serializer, Object object, String key, Object propertyValue) {

8 List<ValueFilter> valueFilters = serializer.getValueFiltersDirect();

17

18 public static String processKey(JSONSerializer serializer, Object object, String key, Object propertyValue) {

19 List<NameFilter> nameFilters = serializer.getNameFiltersDirect();

28

29 public static String processKey(JSONSerializer serializer, Object object, String key, byte intValue) {

30 List<NameFilter> nameFilters = serializer.getNameFiltersDirect();

41

42 public static String processKey(JSONSerializer serializer, Object object, String key, short intValue) {

43 List<NameFilter> nameFilters = serializer.getNameFiltersDirect();

54

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;

2

9

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);

54

55 if (lexer.token() == JSONToken.NULL) {

56 lexer.nextToken(JSONToken.COMMA);

63

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);

54

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);

90

ProducerImpl.java (https://gitlab.com/tanxinzheng/activemq-api) Java · 125 lines

2

3 import com.alibaba.fastjson.JSONObject;

4 import com.udfex.ucs.amq.api.service.ProducerService;

58 try {

59 ConsumeResult consumeResult = JSONObject.parseObject(message, ConsumeResult.class);

60 if (ConsumeResult.CONSUME_SUCCESS_CODE == consumeResult.getResultCode()) {

MetricTimerTask.java (https://gitlab.com/zhengdingke/gmonitor) Java · 107 lines

9

10 import com.alibaba.fastjson.JSON;

11 import com.google.common.collect.Maps;

90 // 以json的形式输入flume

91 // log.info(JSON.toJSONString(info, true));

92 client.sendDataToFlume(JSON.toJSONString(info));

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;

102

103 logger.debug("Save SessionMessageDao into DB. Message: {}. Dao: {}", JSON.toJSONString(body), JSON.toJSONString(dao));

104

107 } else {

108 logger.debug("Find existing SessionMessageDao for message: {}. Dao: {}", JSON.toJSONString(body), JSON.toJSONString(dao));

109 }

135

136 logger.debug("Save GroupMessageDao into DB. Message: {}. Dao: {}", JSON.toJSONString(groupMsgBody), JSON.toJSONString(groupMsgDao));

137

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;

30

48

49 @Ignore("FastJson bug: com.alibaba.fastjson.JSONException: create asm serilizer error, class char")

50 @Test

52

53 @Ignore("FastJson bug: com.alibaba.fastjson.JSONException: create asm serilizer error, class char")

54 @Test

150

151 @Ignore("FastJson bug: com.alibaba.fastjson.JSONException: illegal identifier : 1")

152 @Test

249

250 @Ignore("FastJson bug: com.alibaba.fastjson.JSONException: illegal identifier : 1")

251 @Test

FastjsonDataFormat.java (https://gitlab.com/matticala/apache-camel) Java · 188 lines

23

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 */

54

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

11

12 import com.alibaba.fastjson.JSONObject;

13

JsonUserType.java (https://gitlab.com/0072016/es) Java · 144 lines

7

8 import com.alibaba.fastjson.JSONObject;

9 import com.alibaba.fastjson.serializer.SerializerFeature;

26 */

27 public class JsonUserType implements UserType, Serializable {

28

75

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

17

18 import com.alibaba.fastjson.JSON;

19 import com.alibaba.fastjson.JSONArray;

20 import com.alibaba.fastjson.JSONObject;

21

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;

2

7

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);

54

JavaBeanSerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 207 lines

15 */

16 package com.alibaba.fastjson.serializer;

17

26

27 import com.alibaba.fastjson.JSONException;

28 import com.alibaba.fastjson.util.FieldInfo;

29 import com.alibaba.fastjson.util.TypeUtils;

30

83

84 protected boolean isWriteClassName(JSONSerializer serializer, Object obj, Type fieldType, Object fieldName) {

85 return serializer.isWriteClassName(fieldType, obj);

87

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

11

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;

118

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;

2

4

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();

17

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;

2

7

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();

20

25

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;

2

5

6 import com.alibaba.fastjson.serializer.JSONSerializer;

7 import com.alibaba.fastjson.serializer.SerializeWriter;

8

9 public class JSONWriter {

10

13

14 private JSONSerializer serializer;

15

50

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;

45

46 MessageWrapper wrapper = JSON.parseObject(json, MessageWrapper.class);

47

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;

2

15

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;

2

7

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();

25

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

2

3 import com.alibaba.fastjson.JSON;

4 import com.linbox.im.message.MessageWrapper;

88

89 String json = aes.decrypt(buf);

90

91 Object message = JSON.parseObject(json, requestResponseType.getClazz());

92

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

8

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

15 */

16 package com.alibaba.fastjson.util;

17

24

25 import com.alibaba.fastjson.JSONException;

26

204 // so this shouldn't happen

205 throw new JSONException(x.getMessage(), x);

206 }

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;

42

43 import com.alibaba.fastjson.util.TypeUtils;

44

47 */

48 public class JSONArray extends JSON implements List<Object>, JSONAware, Cloneable, RandomAccess, Serializable {

49

IdentityHashMap.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 96 lines

15 */

16 package com.alibaba.fastjson.util;

17

DispatchToSingleHandler.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 161 lines

2

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();

40

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

2

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;

77

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

6

7 import com.alibaba.fastjson.JSON;

8

99 //DESERIALISASI JSON DATA RAMALAN CUACA PER HARI

100 public CuacaPerHari parseJSONCuacaHarian(String stringJson) {

101

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) {

116

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;

2

7

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();

20

25

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;

17

22 @Deprecated

23 public class DefaultExtJSONParser extends DefaultJSONParser {

24

25 public DefaultExtJSONParser(String input){

26 this(input, ParserConfig.getGlobalInstance());

28

29 public DefaultExtJSONParser(String input, ParserConfig mapping){

30 super(input, mapping);

32

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

2

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();

39

40 try {

41 final Message groupMessage = JSON.parseObject(json, Message.class);

42

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

15 */

16 package com.alibaba.fastjson.serializer;

17

32

33 public final void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType)

34 throws IOException {

ByteArraySerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 43 lines

15 */

16 package com.alibaba.fastjson.serializer;

17

27

28 public final void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {

29 SerializeWriter out = serializer.getWriter();

MapSerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 180 lines

15 */

16 package com.alibaba.fastjson.serializer;

17

33 @SuppressWarnings({ "rawtypes", "unchecked" })

34 public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {

35 SerializeWriter out = serializer.getWriter();

ByteCreator.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 35 lines

2

3 import com.alibaba.fastjson.JSON;

4 import com.linbox.im.exceptions.IMException;

32 public String toWrapperJson() {

33 return JSON.toJSONString(toWrapper());

34 }

User.java (https://bitbucket.org/leafiwan/collegemailsystem.git) Java · 338 lines

11

12 import org.apache.struts2.json.annotations.JSON;

13

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() {

174

175 @JSONField(serialize = false)

176 public int getSharingCount() {

Restful.java (https://gitlab.com/sxyseo/dubbox) Java · 92 lines

20 import com.alibaba.dubbo.registry.common.domain.User;

21 import com.alibaba.fastjson.JSON;

22

57 context.put("operatorAddress", operatorAddress);

58 String jsonResult = null;

59 try {

79 try {

80 jsonResult = JSON.toJSONString(result);

81 os.print(jsonResult);

BigIntegerDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 41 lines

1 package com.alibaba.fastjson.parser.deserializer;

2

5

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

15 */

16 package com.alibaba.fastjson.serializer;

17

29 @SuppressWarnings("rawtypes")

30 public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {

31 AtomicReference val = (AtomicReference) object;

IMMessageEncoder.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 45 lines

2

3 import com.alibaba.fastjson.JSON;

4 import com.linbox.im.message.MessageWrapper;

32

33 byte[] content = aes.encrypt(JSON.toJSONString(messageWrapper.content));

34

LoopQuery.scala (https://gitlab.com/coinmachine/ares) Scala · 198 lines

2

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

2

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;

2

5

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;

12

19 @Override

20 public void parseField(DefaultJSONParser parser, Object object, Type objectType, Map<String, Object> fieldValues) {

21 Integer value;

22

23 final JSONLexer lexer = parser.getLexer();

24 if (lexer.token() == JSONToken.LITERAL_INT) {

ThreadLocalCache.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 117 lines

1 package com.alibaba.fastjson.util;

2

PingHandler.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 59 lines

2

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();

33

34 try {

35 logger.debug("Start handling Ping: {}", json);

36

37 MessageWrapper wrapper = JSON.parseObject(json, MessageWrapper.class);

38

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

2

3 import com.alibaba.fastjson.JSON;

4 import com.alibaba.fastjson.JSONObject;

44

45 MessageWrapper wrapper = JSON.parseObject(json, MessageWrapper.class);

46

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

2

3 import com.alibaba.fastjson.JSON;

4 import org.apache.commons.collections.MapUtils;

57 } else {

58 cacheMap.put(key, JSON.toJSONString(value));

59 }

SameUrlDataInterceptor.java (https://gitlab.com/mrsunchangemyselfsun/ruoyi-vue) Java · 110 lines

9 import org.springframework.stereotype.Component;

10 import com.alibaba.fastjson.JSONObject;

11 import com.ruoyi.common.annotation.RepeatSubmit;

52 {

53 nowParams = JSONObject.toJSONString(request.getParameterMap());

54 }

Feature.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 106 lines

15 */

16 package com.alibaba.fastjson.parser;

17

JsonFilePageModelPipeline.java (https://gitlab.com/taichu/webmagic) Java · 56 lines

2

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 {

25

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;

2

10

11 import com.alibaba.fastjson.JSONException;

12 import com.alibaba.fastjson.parser.DefaultJSONParser;

13 import com.alibaba.fastjson.parser.JSONToken;

14

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

2

3 import com.alibaba.fastjson.JSON;

4 import com.google.common.base.Strings;

113

114 String json = JSON.toJSONString(wrapper);

115

116 kafkaProducer.send(new ProducerRecord(MessageTopic.TOPIC_SEND_MSG, json));

117 }

134

135 outboxService.put(targetUserId, systemMessage.toWrapperJson());

136 }

DoubleSerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 58 lines

15 */

16 package com.alibaba.fastjson.serializer;

17

27

28 public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {

29 SerializeWriter out = serializer.getWriter();

SerializeConfig.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 175 lines

15 */

16 package com.alibaba.fastjson.serializer;

17

42

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

2

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

2

3 import com.alibaba.fastjson.JSON;

4 import com.linbox.im.message.*;

60

61 String json = JSON.toJSONString(wrapper);

62

71

72 kafkaProducer.send(new ProducerRecord<String, String>(MessageTopic.TOPIC_SYNC_UNREAD, json));

73 break;

91

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

4

5 import com.alibaba.fastjson.JSON;

6

45 public String toString() {

46 return JSON.toJSONString(this);

47 }

FastJsonObjectInput.java (https://gitlab.com/sxyseo/dubbox) Java · 138 lines

15 */

16 package com.alibaba.dubbo.common.serialize.support.json;

17

27 import com.alibaba.dubbo.common.utils.PojoUtils;

28 import com.alibaba.fastjson.JSON;

29

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

2

3 import com.alibaba.fastjson.annotation.JSONField;

4

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;

21

22 @JSONField(name = "group_id")

23 public String groupId;

LogUtils.java (https://gitlab.com/0072016/es) Java · 150 lines

2

3 import com.alibaba.fastjson.JSON;

4 import com.google.common.collect.Lists;

117 Map<String, String[]> params = request.getParameterMap();

118 return JSON.toJSONString(params);

119 }

133 }

134 return JSON.toJSONString(headers);

135 }

GangliaWriter.java (https://gitlab.com/zhengdingke/gmonitor) Java · 309 lines

15

16 import com.alibaba.fastjson.JSON;

17 import com.alibaba.fastjson.annotation.JSONCreator;

58

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

2

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 {

32

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;

17

19

20 import com.alibaba.fastjson.annotation.JSONField;

21 import com.alibaba.fastjson.util.FieldInfo;

40

41 JSONField annotation = fieldInfo.getAnnotation(JSONField.class);

42

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

2

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;

8

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

1 package com.alibaba.fastjson.serializer;

2

11

12 public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {

13 SerializeWriter out = serializer.getWriter();

JsonFilePipeline.java (https://gitlab.com/taichu/webmagic) Java · 47 lines

2

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 {

22

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

2

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

2

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;

2

5

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;

12

22

23 public abstract Object createInstance(DefaultJSONParser parser, Type type);

24

54 public boolean parseField(DefaultJSONParser parser, String key, Object object, Type objectType, Map<String, Object> fieldValues) {

55 JSONScanner lexer = (JSONScanner) parser.getLexer(); // xxx

56

DateSerializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 124 lines

15 */

16 package com.alibaba.fastjson.serializer;

17

23

24 import com.alibaba.fastjson.util.IOUtils;

25

32

33 public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {

34 SerializeWriter out = serializer.getWriter();

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);

42

43 MessageWrapper wrapper = JSON.parseObject(json, MessageWrapper.class);

44

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);

68

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

115

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

15 */

16 package com.alibaba.fastjson.serializer;

17

18 import com.alibaba.fastjson.util.FieldInfo;

19

30 @Override

31 public void writeProperty(JSONSerializer serializer, Object propertyValue) throws Exception {

32 SerializeWriter out = serializer.getWriter();

CharArrayDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 47 lines

1 package com.alibaba.fastjson.parser.deserializer;

2

4

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();

39

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;

2

5

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

4 import android.support.annotation.NonNull;

5 import com.alibaba.fastjson.JSON;

6 import com.gzsll.hupu.Constants;

52 String result = mOkHttpHelper.getStringFromServer(Constants.UPDATE_URL);

53 return JSON.parseObject(result, UpdateInfo.class);

54 } catch (Exception e) {

AbstractDateDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 99 lines

1 package com.alibaba.fastjson.parser.deserializer;

2

4

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;

11

15 public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {

16 JSONScanner lexer = (JSONScanner) parser.getLexer();

17

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

7

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;

2

4

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;

10

18 @SuppressWarnings("unchecked")

19 public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {

20 JSONLexer lexer = parser.getLexer();

21

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

91 #FASTJSON

92 -dontwarn com.alibaba.fastjson.**

93 -keep class com.alibaba.fastjson.** { *; }

SimpleTest.java (https://gitlab.com/iamshijun/spring_demo) Java · 78 lines

10

11 import com.alibaba.fastjson.JSON;

12 import com.alibaba.fastjson.JSONArray;

13 import com.alibaba.fastjson.JSONObject;

14

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;

17

27

28 public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {

29 write(serializer, (String) object);

31

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;

2

4

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;

22

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;

17

21

22 import com.alibaba.fastjson.annotation.JSONField;

23 import com.alibaba.fastjson.util.FieldInfo;

46

47 JSONField annotation = fieldInfo.getAnnotation(JSONField.class);

48 if (annotation != null) {

72

73 public void writePrefix(JSONSerializer serializer) throws IOException {

74 SerializeWriter out = serializer.getWriter();

94

95 public abstract void writeProperty(JSONSerializer serializer, Object propertyValue) throws Exception;

96

LocalServiceInvoker.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 120 lines

22

23 import com.alibaba.fastjson.JSON;

24 import com.alibaba.fastjson.JSONArray;

25 import com.alibaba.fastjson.JSONObject;

26

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

9

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;

18

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;

2

5

6 import com.alibaba.fastjson.JSONArray;

7 import com.alibaba.fastjson.parser.DefaultJSONParser;

8 import com.alibaba.fastjson.parser.JSONToken;

9

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;

20

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;

2

6

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();

19

20 if (lexer.token() == JSONToken.NULL) {

21 lexer.nextToken();

24

25 parser.accept(JSONToken.LBRACE);

26

ServiceRequest.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 206 lines

11

12 import com.alibaba.fastjson.JSONObject;

13

54 /** 头信息. */

55 private JSONObject headers;

56

57 /** 应用参数. */

58 private JSONObject params;

59

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

2

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()

14

34

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

8

9 import com.alibaba.fastjson.JSON;

10 import com.alibaba.fastjson.JSONObject;

11

12 public class TestJson {

13

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

2

3 import com.alibaba.fastjson.JSON;

4

26 Object result = method.invoke(object, args);

27 System.out.println(JSON.toJSON(result));

28

NumberDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 91 lines

1 package com.alibaba.fastjson.parser.deserializer;

2

5

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);

27

SendMsgResponse.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 39 lines

2

3 import com.alibaba.fastjson.annotation.JSONField;

4

8 public class SendMsgResponse extends ByteCreator {

9 @JSONField(name = "r_id")

10 public long rId;

11

12 @JSONField(name = "msg_r_id")

13 public long msgRId;

14

15 @JSONField(name = "user_id")

16 public String userId;

17

18 @JSONField(name = "remote_id")

19 public String remoteId;

GangliaSink.java (https://gitlab.com/zhengdingke/htest) Java · 58 lines

12

13 import com.alibaba.fastjson.JSON;

14 import com.zdingke.flume.ganglia.metric.GangliaWriter;

45 private void sendDataToGanglia(String data) {

46 MetricInfo info = JSON.parseObject(data,MetricInfo.class);

47 String []strs= info.getGmetadInfo().split(":");

DefaultFieldDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 48 lines

1 package com.alibaba.fastjson.parser.deserializer;

2

5

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;

11

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

15 */

16 package com.alibaba.fastjson.serializer;

17

UserHelper.java (https://github.com/dawnsait/holywar.git) Java · 44 lines

2

3 import com.alibaba.fastjson.JSON;

4 import com.fasheng.service.dto.PartnerUserDTO;

11 public static PartnerUserLoginRequest getPartnerUserLoginRequest(String requestInfo) {

12 return JSON.parseObject(requestInfo, PartnerUserLoginRequest.class);

13 }

JSONToken.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 117 lines

15 */

16 package com.alibaba.fastjson.parser;

17

20 */

21 public class JSONToken {

22

LocaleDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 36 lines

1 package com.alibaba.fastjson.parser.deserializer;

2

5

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

1 package com.alibaba.fastjson.serializer;

2

11

12 public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {

13 if (object == null) {

JSONException.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 36 lines

15 */

16 package com.alibaba.fastjson;

17

20 */

21 public class JSONException extends RuntimeException {

22

24

25 public JSONException(){

26 super();

28

29 public JSONException(String message){

30 super(message);

32

33 public JSONException(String message, Throwable cause){

34 super(message, cause);

BooleanDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 55 lines

1 package com.alibaba.fastjson.parser.deserializer;

2

4

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();

21

22 if (lexer.token() == JSONToken.TRUE) {

23 lexer.nextToken(JSONToken.COMMA);

SendDispatcher.java (https://gitlab.com/Mr.Tomato/linbox_server) Java · 60 lines

2

3 import com.alibaba.fastjson.JSON;

4 import com.linbox.im.exceptions.IMException;

34

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 }

39

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;

2

8

9 import com.alibaba.fastjson.JSONException;

10 import com.alibaba.fastjson.parser.DefaultJSONParser;

11 import com.alibaba.fastjson.parser.JSONToken;

12

17 @SuppressWarnings("unchecked")

18 protected <T> T cast(DefaultJSONParser parser, Type clazz, Object fieldName, Object val) {

19

49

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

1 package com.alibaba.fastjson.serializer;

2

37

38 public boolean apply(JSONSerializer serializer, Object source, String name) {

39 if (source == null) {

JSONField.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 44 lines

15 */

16 package com.alibaba.fastjson.annotation;

17

22

23 import com.alibaba.fastjson.parser.Feature;

24 import com.alibaba.fastjson.serializer.SerializerFeature;

30 @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER })

31 public @interface JSONField {

32

RedisScheduler.java (https://gitlab.com/taichu/webmagic) Java · 128 lines

2

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

12

13 import com.alibaba.fastjson.JSON;

14 import com.kingdeehit.bigdata.appmetric.ganglia.GangliaWriter;

46 private void sendDataToGanglia(String data) {

47 MetricInfo info = JSON.parseObject(data,MetricInfo.class);

48 String []strs= info.getGmetadInfo().split(":");

FieldVisitor.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 45 lines

29 */

30 package com.alibaba.fastjson.asm;

31

SqlDateDeserializer.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 61 lines

1 package com.alibaba.fastjson.parser.deserializer;

2

7

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) {

34

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

11

12 import com.alibaba.fastjson.JSON;

13 import com.alibaba.fastjson.JSONArray;

14 import com.alibaba.fastjson.JSONObject;

15

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;

2

5

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;

12

23 @Override

24 public void parseField(DefaultJSONParser parser, Object object, Type objectType, Map<String, Object> fieldValues) {

25 Long value;

26

27 final JSONLexer lexer = parser.getLexer();

28 if (lexer.token() == JSONToken.LITERAL_INT) {

SerialWriterStringEncoder.java (https://bitbucket.org/xiejuntao/xdesktop.git) Java · 75 lines

1 package com.alibaba.fastjson.serializer;

2

10

11 import com.alibaba.fastjson.JSONException;

12 import com.alibaba.fastjson.util.ThreadLocalCache;

59 // so this shouldn't happen

60 throw new JSONException(x.getMessage(), x);

61 }

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;

121

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