Questions tagged [fastjson]

A fast JSON parser/generator for Java, or a smallest, fastest polymorphic JSON serializer for C#.

Fastjson(disambiguation)

java

Fastjson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. Fastjson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of.

C#

Fastjson is the smallest and fastest polymorphic JSON serializer.

49 questions
-1
votes
0 answers

What is the difference between JSON. parseObject (apiDoc, JSONObject. class) and new JSONObject (apiDoc) in fastjson?

I have a string called apiDoc. The JSONObject converted using JSON.parseObject (apiDoc, JSONObject. class) is empty, but new JSONObject (apiDoc) or JSON.parseObject (apiDoc, HashMap. class) can be successfully converted. What is the reason? The…
flower
  • 2,212
  • 3
  • 29
  • 44
-1
votes
1 answer

How to handle Java return JSONObject variable type if it can be an Array or a String

I try to parse a JSON file using Alibaba Fastjson Java library. One of the JSONObject of the file is either an Array or a String. Below is the Java snippet @JSONField(name="States") private Object[] states; This can be used when the JSONObject is…
Charles Brown
  • 917
  • 2
  • 10
  • 20
-1
votes
1 answer

fastjson java.lang.Integer cannot be cast to java.lang.Long

I have a code snippet Map map = new HashMap<>(); map.put("a", new Long(11L)); String jsonStr = JSONObject.toJSONString(map); System.out.println("jsonStr : " + jsonStr); JSONObject jsonObject = JSON.parseObject(jsonStr); Long a =…
learner
  • 1,381
  • 1
  • 10
  • 16
-2
votes
1 answer

Is there a python equivalent to the Unix '$?' command?

I am using fastjsonschema for validating json records against its schema. Some thing like this: import fastjsonschema validate = fastjsonschema.compile({'type': 'string'}) validate('hello') If the json is valid, it returns the json string else…
1 2 3
4