Questions tagged [flexjson]

Flexjson is a lightweight library for serializing and deserializing Java objects into and from JSON.

Flexjson - JavaScript Object Notation (aka JSON) is a very popular alternative to XML for transmitting data to the web browser. Flexjson is a lightweight library for serializing and deserializing Java objects into and from JSON. What's different about Flexjson is it's control over what gets serialized allowing both deep and shallow copies of objects. Most JSON serializers mimic object serialization libraries and try to serialize the entire object graph from the object being turned into JSON. This causes problems when you want a connected object model in your server, but you can't send that object model to the client because the serialization library will try to send the entire object graph. This makes it very hard to create object oriented models and serialize pieces of that model to the client without sending everything. Other JSON libraries require you to create a lot of boiler plate code to translate your object representation into a JSON object. In this regard I shouldn't have to explain myself, but to keep it short let's me just say I hate boiler plate translation code! Flexjson tries to solve both of these problems by offering a higher level API or dare I say DSL for specifying your intent.

Official Website: http://flexjson.sourceforge.net/

Useful Links:

87 questions
0
votes
1 answer

How to use alternative JSON lib from Spring MVC

My understanding is that Spring MVC ships with a version/dependency of the Jackson JSON library. I really like/prefer FlexJSON and was wondering if it is possible to configure Spring to use FlexJSON instead, and if so, how?
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
0
votes
0 answers

Is it possible to exclude fields from deserialization?

I have Entity which contains some fields like id, name, address. When creating a new entity form a rest call I want to deserializae received json (using flexjson) to the object. But I want to exclude the id field. I know Serialize has the exclude…
Marcel Overdijk
  • 11,041
  • 17
  • 71
  • 110
0
votes
0 answers

Flexjson security issue deserializing java.lang.Class, no constructor accessible

I can serialize objects of type GenericContainer, but when deserializing, I'm getting a security exception (see below). I suspect the issue is that java.lang.Class has no default (no arg) constructor, which Flexjson requries; is there a way around…
raffian
  • 31,267
  • 26
  • 103
  • 174
0
votes
1 answer

Java flexjson Serializing composed JSON objects

I have a Java class and I want to generate a JSON string from an object of the class. However, the members of the class are as follows: /** * The set containing the footer texts */ public HeaderOrFooter[] footers = null; /** * The title of the…
Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175
0
votes
1 answer

flexjson and versioning : how accommodating change is flexjson?

I'm considering using flexjson to serialise my business objects to a file in an android application, simply using JSONSerializer().deepSerialise(myObject) and JSONDeserializer().deserialise(jsonString) with all the default transformers and object…
Phil
  • 377
  • 1
  • 2
  • 14
0
votes
1 answer

Serializing objects with flexjson

I am trying to use flexjson library. But in my object I have to use: com.google.api.client.util.DateTime which do not have no parameters constructor. I always get NoSuchMethodException with message: Flexjson will instantiate any protected, private,…
sennin
  • 8,552
  • 10
  • 32
  • 47
0
votes
1 answer

Deserializing a many-to-one relation with FlexJSON

I am adding RESTful support to my web application (with Spring) so I can do CRUD operations like this: Read info about a participant (JSONSerialize): $ curl -i -H "Accept: application/json" http://localhost:8080/dancingwithstars/participant/1 { …
Agustin Treceno
  • 351
  • 3
  • 5
0
votes
2 answers

How to avoid "flexjson.JSONSerializer" convert Datetime Object to Timestamp? I want string like yyyy/MM/dd hh:mm:ss

I'm using flexjson.JSONSerializer to serialize Java Object, but when serializes Date property, it is converted into Timestamp: new JSONSerializer().exclude("*.class").serialize(obj); How can flexjson convert from Date to String of readable time?
JerryCai
  • 1,663
  • 4
  • 21
  • 36
0
votes
1 answer

FlexJSON change property name - on Date fields

I found this bit of code from here: Change property name with Flexjson It works for String data types but seemingly no others. Any ideas? public class FieldNameTransformer extends AbstractTransformer { private String transformedFieldName; …
bladmiral
  • 225
  • 1
  • 11
-1
votes
1 answer

I get stackoverflow error when trying to convert my class to Json

I am trying to convert a a list Objects i received from the database to Json but i get when i try to convert. java.lang.StackOverflowError: null at…
Thanus
  • 411
  • 2
  • 8
  • 21
-1
votes
1 answer

Java : 64 based string decode / parse failed

I am trying to convert this 64 based encoded JSON string and convert received JSON into POJO using flexjson API. First try block, converts direct JSON as string into object which is success. This string is decoded using online tool. Now second try…
Gaurav Saraf
  • 23
  • 1
  • 11
-1
votes
1 answer

FlexJson Error : ClassCastException: java.util.HashMap cannot be cast to class

This is the error I get while I try to cast my LONGTEXT object from mysql back to my ProcessInputs java object using FlexJSON. java.lang.ClassCastException: java.util.HashMap cannot be cast to org.juzzy.server.ProcessInputs at…
Div R
  • 27
  • 6
1 2 3 4 5
6