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
9
votes
1 answer

FlexJson ClassNotFound Exception on Android 4.4.4

I´ve got a multidex project for Android devices. I use Flexjson. I´ve already tested it with flexjson 3.3 and 2.x. It works perfectly well with android 5.x but crashes in Android 4.4.4. It looks like the Dex support library is not working propperly…
eduyayo
  • 2,020
  • 2
  • 15
  • 35
8
votes
2 answers

FlexJSON doesn't serialize class objects fully

I am new to FlexJson and was following http://flexjson.sourceforge.net/ for simple tutorial. I wrote a simple program but it seems not to be serializing the object attributes. Please help me if someone knows about this package…
daydreamer
  • 87,243
  • 191
  • 450
  • 722
6
votes
3 answers

How to exclude null-value fields when using Flexjson?

I am serializing a class like this into JSON using Flexjson: public class Item { private Long id; private String name; private String description; ... // Getters and setters ... } Many of the Item fields can be null (e.g.,…
Matthias
  • 230
  • 1
  • 3
  • 9
6
votes
2 answers

Flexjson and Dexguard/Proguard

I am having issues using dexguard when it comes to flexjson library. I keep getting the following error when trying to deserialize using JSONDeserializer. **09-15 20:46:10.271 10901-11552/** **A/art: sart/runtime/class_linker.cc:3430] Check failed:…
joseporto
  • 318
  • 2
  • 9
6
votes
2 answers

FlexJson - Unable to Serialize Double[] array

I have a simple user class with a Double[] variable for specifying a user's location. @Document public class User { private long id; private Double[] location; } This is the code that i have tried with to serialize my User object new…
user1955934
  • 3,185
  • 5
  • 42
  • 68
5
votes
1 answer

Mapping a JSONObject to a List with Flexjson in Java / Android

I'm currently trying to use Flexjson to deserialize a JSON String and map it to the Object model of my Android App. The application is a kind of library with several vendors that can have some catalogs with more catalogs and documents in them. The…
lcs.bdr
  • 388
  • 1
  • 9
4
votes
1 answer

How to deserialize a Map with integer key in java

I have been using flexjson api to serialize and deserialize a map with integer keys. Now while deserializing the map keys gets converted to string. Is there some way in which the keys can be retained as integer. Here is a sample code…
Raks
  • 870
  • 3
  • 11
  • 27
4
votes
0 answers

How can I deserialize part of a JSON string into an object, using FlexJSON?

I'm trying to serialze part of a JSON string into an object. The JSON string looks as follows: {"error":null,"excludeFields":null,"message":null,"success":{"user":{"name":null,"organizationId":100,"username":"nl4321"}}} I only need the user-part of…
DandyDev
  • 319
  • 3
  • 13
4
votes
2 answers

FlexJSON failing to deserialize Date

I'm working with FlexJSON and am having trouble parsing a Date object from an int. I'm trying to use the JSONDeserializer like so: String json = decryptJson(new String(personalInformationData)); return new…
3
votes
1 answer

Change property name with Flexjson

I use FlexJson for serialization, the only problem is that it generates the field names lower case while I need them to start with upper case: class Person { String name; public String getName() { return name;} } When serialized the field…
AhHatem
  • 1,415
  • 3
  • 14
  • 23
3
votes
1 answer

FlexJson and @JSON annotation - @JSON(name = "") not working

I just switched to FlexJson and I am already having a problem. The documentation at http://flexjson.sourceforge.net/, chapter Controlling JSON naming with @JSON states : When an object is serialized the names of the properties on JSON objects are…
ElDuderino
  • 3,253
  • 2
  • 21
  • 38
3
votes
1 answer

Flexjson - how to serialize a complex hierarchy including a Map

Using Flexjson, I am trying to serialize an object ("Payload") that contains a List. Each MyBean has a field "items", which is a Map>. When I serialize this Payload object, the map field ("items") is empty. public class Payload { private…
davedonohue
  • 212
  • 5
  • 14
3
votes
2 answers

How to serialize Map> with FlexJSON

I have a object which I want to serialize to JSON. This object is a map with list of a specific objects. This looks similar to it: Map> map = new Map>(); I am using FlexJSON. I can work only with…
woyaru
  • 5,544
  • 13
  • 54
  • 92
3
votes
4 answers

Deserializing JSON list into list of objects with Flexjson

I'm trying to deserialize the following json: { "books": [ {"id":"1","name":"book 1"}, {"id":"2","name":"book 2"} ] } Into a List. It worked before with this json: [ {"id":"1","name":"book 1"}, {"id":"2","name":"book 2"} ] } Using this…
vikke
  • 127
  • 2
  • 14
2
votes
1 answer

How to serialize transient fields in the model via FlexJson?

I am using Play Framework to expose REST API, which returns some JSON objects. To simplify the API usage, I would like to return a "calculated" field in the response. Unfortunately, in my tests, while FlexJson does not ignore the transient model…
Max
  • 643
  • 11
  • 27
1
2 3 4 5 6