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
2
votes
2 answers

How do I get values from a complex JSON object?

Is it possible that someone could show me how to get the names of these pizza places printing out? My application prints out the expected "Status Code: 200". However, my console only shows empty brackets []. I suspect that I am not pulling values…
TeeJ
  • 35
  • 1
  • 8
2
votes
2 answers

Unable to set jsonSerialization in Azure

The app I'm trying to put in Azure was built in ASP.NET 3.5, and I converted it to 4.0 when moving it to the cloud. Everything works great, until I try to add this block to my web.config:
Kevin Griffin
  • 2,239
  • 4
  • 25
  • 27
2
votes
4 answers

Skipping nested field with Jackson data binding?

How must I bind (bidirectional) the following json snippet to the Java objects below with Jackson? I want the key/value pairs of the Json newsletter node to end up in the Map of the newsletter field. What must be the Jackson config (annotations and…
edbras
  • 4,145
  • 9
  • 41
  • 78
2
votes
0 answers

How to Customize json result in Mvc Web Api

In my Web Api application I return both xml and json result. The format is specified in the URL.Based on the url I specified it in Global.asax and return the result. Global.asax is protected void Application_Start() { …
Sanjeev S
  • 626
  • 1
  • 8
  • 27
2
votes
0 answers

SignalR Serialization issue

Signalr Hub Client trying to call Subscribe method of Hub with object of TopicFilter which doesn't de-serialize properly in hub. The type received in Subsribe is Filter whereas i want TopicFilter object in there. It works if i manual serialize and…
2
votes
1 answer

Genson serialization Issue with byte and Date fields

Hi I am using Genson for ser/de for my POJO classes. But there is a problem while serializing a POJO which has a byte field. I haven't tried deserialization of same object. So I don't know whether that's also working. Also there is problem in date…
iCode
  • 8,892
  • 21
  • 57
  • 91
2
votes
1 answer

What is the correct way in C# to parse this date format "Mon Oct 07 00:00:00 EDT 2013"?

I am getting a json message from a server and I am trying to parse it into C# objects. I am using the RestSharp Deserializer. There is one field that is not properly converting into a datetime: the string value of the field in this message…
leora
  • 188,729
  • 360
  • 878
  • 1,366
2
votes
2 answers

SignalR datetime IsoString to UTC

I'm sending via SignalR a DateTime Object from ServerSide without unspecified kind: myDate.Kind //Unspecified I'm setting the JsonConvert defaultSettings to use UTC, as suggested here: JsonConvert.DefaultSettings = () => new…
Mario Levrero
  • 3,345
  • 4
  • 26
  • 57
2
votes
1 answer

Custom Json Enum Serialization using ServiceStack

I'm trying to serialize enum in json. If Enum Value is "Male" and "Female". I want it as "M" and "F". Here is the code sample,it works for XmlSerializer but i need to make it work for JsonSerializer public enum Gender { [EnumMember(Value = "M"),…
Krushal
  • 23
  • 2
2
votes
1 answer

Customize JSON serializer in Django

I am serializing a Django queryset which gives me an output like [{"pk": 3, "model": "appname.somemodel", "fields": {"name": "value", "name": "value" }}] I am only interested in the fields. So I am trying to overriding the serializer. I have…
Jamgreen
  • 10,329
  • 29
  • 113
  • 224
2
votes
1 answer

How to set NullValueHandling.Include JsonSerializerSettings in a NEST client via ModifyJsonSerializerSettings

In a c# application I'm doing var settings = new ConnectionSettings(node); settings.ModifyJsonSerializerSettings(new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Include }); var client = new…
lucian
  • 17
  • 3
2
votes
2 answers

Jackson2 Java to Json array ignore field names when creating array

I'm trying to create a Java REST endpoint which returns a JSON data array to be consumed by JQuery FLOT charting plugin. At a minimum, the JSON data for FLOT needs to be an array of numbers i.e. [ [x1, y1], [x2, y2], ... ] Given I have a List of…
Ayub Malik
  • 2,488
  • 6
  • 27
  • 42
2
votes
2 answers

Can ServiceStack's JsonSerializer serialize private members?

My concern is mainly with ServiceStack's Redis client. I have a bunch of entities that I want to store in cache. Their members are mostly encapsulated (private), and some of them don't have any public accessor. Do ServiceStack's serializers allow me…
2
votes
1 answer

Cannot deserialize the current JSON array (e.g. [1,2,3]) into type with complex and nested objects

I`m trying to build web api for complex object. For this aim I built the custom binder which deserialize this object from JSON. My Customer Binder looks like: var paramType = p_BindingContext.ModelType; dynamic updatedParam =…
sasha berd
  • 35
  • 1
  • 3
2
votes
1 answer

ServiceStack JsonSerializer not serializing object members when inheritance

I'm trying to use ServiceStack.Redis and i notice that when i store an object with members that are object that inheritance from another object and try to get it later on i get null. I checked and found that ServiceStack.Redis is using…
Omri
  • 887
  • 8
  • 24