Questions tagged [jsonserializer]

The JsonSerializer enables to control how objects are encoded into JSON. JSONSerializer will also pay attention to any method or field annotated by JSON.

JSONSerializer is the main class for performing serialization of Java objects to JSON. JSONSerializer by default performs a shallow serialization. While this might seem strange there is a method to this madness. Shallow serialization allows the developer to control what is serialized out of the object graph. This helps with performance, but more importantly makes good OO possible, fixes the circular reference problem, and doesn't require boiler plate translation code.

A simple example:

JSONSerializer serializer = new JSONSerializer();
return serializer.serialize( person );

Source:

Related tags:

512 questions
0
votes
2 answers

JSON Deserializer "loses" last property of JSON value

passing a Json value like this one(this will be the var jsonValue in…
jimmious
  • 358
  • 3
  • 19
0
votes
2 answers

.net circularReferenceException when converting to JSON. How to Limit references?

I have two model classes, Address and Product, they are in a many-to-many relationship on the Database. When I try to load Addresses using Include() to also get the Products, I get a circularReferenceException when I try to convert it to a JSON.…
Kendoha
  • 99
  • 11
0
votes
1 answer

Getting SerializableException while saving data into isolated storage

I am working on windows phone 8 app. In which I need to call an api to get some response, that I am serializing and saving into local settings While saving these data I am getting an exception of type…
0
votes
1 answer

how to remove double quote and \ from nested value

I have written a code to convert list to json but I have a problem. When I test web method I see that I have " and \ added to the nested object. I want to know how can I remove them using JavaScriptSerializer(). var innerResult (linq query to get…
user474901
0
votes
0 answers

Getting a JSON string response from web method

In my web application there is a WCF web service. In the following method public string GetPolicyDetails(GetPolicyDetails_ML ml) { var strFileName = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), …
Isanka Lakshan
  • 33
  • 2
  • 10
0
votes
0 answers

Json conversion exception

"{\"id\":20,\"Title\":\"Parti 8\",\"Description\":\"Parti ve daha çok parti iste bu açikalamada, bilmeyenler anlamaz dedigimiz bir parti ve parti iste budur o…
Ege Aydın
  • 1,041
  • 1
  • 13
  • 27
0
votes
1 answer

Cannot set property 'all' of undefined

I'm having a problem getting a response form an API in my Ember.JS application. I'm using a "dummy" API just to learn Ember with and I didn't feel like creating my own back end (this one specifically). Whenever I try to navigate to the Posts…
kylieCatt
  • 10,672
  • 5
  • 43
  • 51
0
votes
4 answers

JSON serialization using newtonsoft in C#

I have the following model structure. public class ReferenceData { public string Version { get; set; } public List Data { get; set; } } public class DataItem { public Dictionary
PaRsH
  • 1,320
  • 4
  • 28
  • 56
0
votes
1 answer

How to deserialize asp.net datetime as JSON datetime with client's timezone

I'm struggling with datetimes a bit. I'm using asp.net mvc api controllers, a microsoft sql server and AngularJS. On some button click I'm sending a JSON formatted date to an api-controller. When I post 2015-11-31 00:00 and I look in Fiddler to see…
0
votes
1 answer

How can I use different Jackson JsonSerializers for the same Java enum in different places?

In a JEE application, I created an enumeration with some custom label strings for the GUI: public enum MyThing { THING1("Label 1"), ... THING5("Label 5"); private String label; private MyThing(String label) { …
Joe7
  • 508
  • 1
  • 4
  • 17
0
votes
1 answer

How to convert an HTML table to JSON and use the JSON with JSON.NET?

I'm asking this question because I think it's one that we run into from time to time. I needed to take an HTML table that had been manipulated client side and send the resulting table data to the server for processing. Additionally, I wanted to…
Fletch
  • 15
  • 1
  • 3
0
votes
0 answers

Remove slashes and quotes from JSON string returned

I am using below code to convert my model class to JSON data [DataContract] public class EventList { [DataMember(Name = "success")] public int success; [DataMember(Name = "result")] public List
Sebastian
  • 4,625
  • 17
  • 76
  • 145
0
votes
0 answers

Don't deserialise property (set value to be raw serialised data)

When deserialization an object is there an easy way to tell the deserializer "don't serialise the content of this property, whatever the serialised data looks like, dump that into this property" (And obviously the reverse when serializing) So I have…
DJL
  • 2,060
  • 3
  • 20
  • 39
0
votes
1 answer

How to set an alternate JsonSerializer to apply to all returns of a specific @Controller class in Spring?

Say I have a default way to serialize Foo objects. How can I set a specific @Controller class to use an alternate JsonSerializer for Foo objects? With @JsonSerialize inside Foo I can only specify one universal behavior for all serializations of it.…
Victor Basso
  • 5,556
  • 5
  • 42
  • 60
0
votes
2 answers

serializing a json file from list of list

So i have a list of elements: elements = [room1, room2, room3] I also have a list of key/value attributes that each room has: keys = ["level", "finish1", "finish2"] values = [["ground", "paint1", "carpet1"],["ground", "paint1", "paint2"], ["second…
konrad
  • 3,544
  • 4
  • 36
  • 75