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
3 answers

String Formatting in C# to handle decimal places

In the Web API there is a Number data type field we retrieve from oracle DB and return in JSON format. Since it is of Number type it shows in the result 364578.0 so now using the string format we are trying to avoid the decimal point like …
user4912134
  • 1,003
  • 5
  • 18
  • 47
0
votes
1 answer

dynamic id and special characters for serialization with flat buffers

I have Json data like below { "!type": "alarm", "$": { "12279": { "!type": "alarm", "title": "Default", "$": { "5955": { "!type": "alarm", "name": "Wake", "day": "SUN", …
gyan deep
  • 1,880
  • 1
  • 13
  • 9
0
votes
1 answer

Swift JSONSerialization.jsonObject Error

I've looked around but I don't find an answer to fix this error that has been bugging me. I tried adding a "as! NSMutableArray" but that gave me another error. Any ideas on how to fix it? I converted my project from Objective-C to Swift, so…
WokerHead
  • 947
  • 2
  • 15
  • 46
0
votes
1 answer

How to Bind a json to an Interface collection, and vice versa within a model using MVC.Net

Update: due the answer, i found old title irrelevant and change it from the 'How to Implement Custom JsonConverter that uses JsonConvert' to what currently it is. I'm in very tight and time limit situation, and i have to do as what the title…
0
votes
2 answers

escaping string for json result in asp.net server side operation

I have a server side operation manually generating some json response. Within the json is a property that contains a string value. What is the easiest way to escape the string value contained within this json result? So this string result = "{…
Jason Jarrett
  • 3,857
  • 1
  • 27
  • 28
0
votes
1 answer

Custom JSON serializer

I have a class, partial class Customer { [JsonProperty] public string Name { get; set; } [JsonProperty] public string Address{ get; set; } [JsonProperty] public string CardInfo { get; set; } public int…
katie77
  • 1,797
  • 4
  • 25
  • 43
0
votes
1 answer

Alternatives to Dynamic JsonParsing

I am using aws lambda's api request template to create and call post methods. I have to send a post body from my code, which should be json serialized. Here is a way I am doing it now: **dynamic pObj = new JObject(); pObj.Url =…
Atihska
  • 4,803
  • 10
  • 56
  • 98
0
votes
2 answers

Why are DriveInfo's properties missing when serializing to json string using Json.NET?

Attempting to serialize DrivInfo to a Json string with this code only return the "name" property: DriveInfo dr = new DriveInfo("C"); string json = Newtonsoft.Json.JsonConvert.SerializeObject(dr); The string result is…
0
votes
1 answer

How to read-write json file without disturbing the sequences of its key-value pairs in iOS?

I am serializing a json file whose key-value pairs should not be shuffled when writing to a new file after editing. Even if I do not edit it still goes shuffles the pairs. I just need the same sequence of the key-value pairs in the new file(written…
Shubham Ojha
  • 461
  • 5
  • 17
0
votes
1 answer

JSON Deserialization to get some particular objects and Serialize with new Json format using C#

For my project I need to Deserialize a long JSON data from Wikipedia. Then I need to get some particular information like Title, Extract, Thumbnail Source, Co-ordinates from that JSON. After getting all these data I need to serialize it again in a…
0
votes
1 answer

Jackson serialize generic collection

I want to use Jackson to serialize an object include a generic collection type. This is the interface: public interface PagingAdapter > extends Serializable { public List getItem(); public…
David
  • 1
  • 1
  • 1
0
votes
1 answer

How to serialise a POJO with two different custom serialisers for two different apis in Spring MVC?

I am using Spring MVC for creating a restful API. I have two different API endpoints where I need to serialise same POJO in two different ways. I have illustrated the same below: Course API url - /course/{id} response - { "id": "c1234", …
mickeymoon
  • 4,820
  • 5
  • 31
  • 56
0
votes
2 answers

Json Serialization using Web Api Controller 2 in ASP.Net MVC

I am trying to serialize json data for a specitic location inforamtion like Name, ShortText, ImageUrl and Geocordinates. I created a PoiInfo.cs class inside the Model for json object.So far the Name, ShortText and Imageurl serialization working…
user5850934
0
votes
1 answer

Convert JSON to appropriate Format using Ember Serializer

I would like to convert the JSON object { User:{ 'Name':"asdas", 'Address_Line_1':"dasdasd" } } to form data Name=asdas&Address_Line_1=dasdasd before sending request to my API Server P.S : I removed root element 'User' using…
Shirabthinath
  • 11
  • 1
  • 5
0
votes
2 answers

Json.net failing to load certain properties belonging to a class object?

NOTE: I'm adding this community wiki entry to save someone the loss of time I just went through debugging this problem. I have a class object with multiple public properties. I can serialize it fine using JSON.net. But when I load the JSON text…
Robert Oschler
  • 14,153
  • 18
  • 94
  • 227