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

Swashbuckle response is wrong with IPagedList

I have a asp.net core project with uses swashbuckle for JS-client generation. To use pagination we use PagedList from X.PagedList nuget. Controller implementation: [HttpGet] [ProducesResponseType(typeof(IPagedList),…
Andre
  • 662
  • 1
  • 8
  • 19
0
votes
1 answer

Set Json Serialization settings in asmx webservice in .net3.5

very stuck atm, have been in .net core world but back to .net3.5 and struggling. I have a asmx webservice that I haven't worked on before, it uses jsonserialisation set in the web.config
Punchmeister
  • 183
  • 2
  • 9
0
votes
1 answer

JsonSerializer Isn't serializing all data

Here's some simple code that deserializes a .json file then serializes it again, making no changes to the data. JObject json = JObject.Parse(File.ReadAllText("fileIn.json")); JsonWriter writer = new JsonTextWriter(new StreamWriter("fileOut.json",…
0
votes
2 answers

MVC Api Controller Serielized parameters

I am doing an MVC 5 Application, and I am calling a API controller method that is in another Solution. I am using HttpClient(). and I am calling PostAsJsonAsync with some parameters, an instance of a class. It looks like this. string apiUrl =…
Diego
  • 2,238
  • 4
  • 31
  • 68
0
votes
0 answers

How would I save JSON outputed by an URL to a file in selenium using c#

I am creating an automation(for Chrome browser) using Selenium 3.4 in c# in which I have a Url that displays JSON content when it load.also, the JSON Url takes a lot of time as it contains around 22MB of data.I want to save that JSON content to a…
0
votes
0 answers

Cannot access Childen of JSON

I need to be able to loop through each "item" from my JSON result. The JSON response looks like this. I would like to be able to access each specific id. { "prop1": { "date": "2017-03-04 3:57:38 PM", "item": [ { "id": "37705", "date":…
Monz
  • 139
  • 1
  • 13
0
votes
1 answer

Want to Serialize in specific format

i want to serialize list object in following format. without square bracket []at start and end without commma , it should be in new line. {"document_id":37577,"document_name":"Office Marketview........} {"document_id":37578,"document_name":"Office…
sangram parmar
  • 8,462
  • 2
  • 23
  • 47
0
votes
2 answers

How to do Conditional Serialization using C# - NewtonSoft.Json

I am doing json serialization using NewtonSoft.Json public class CommonBase { [JsonProperty(PropertyName = "u_customer_id")] public long CustomerId { get; set; } } I want to do a conditional serialization so that if CustomerId value is 0, I…
vmb
  • 2,878
  • 15
  • 60
  • 90
0
votes
2 answers

Parsing JSON in Swift 3 after JSON file download, NSCocoaErrorDomain Code=3840

So, I keep getting the error below when I attempt to do a JSONSerialization on a JSON object I download for an app I'm building. Basically, what I've done is I create a JSON file, save it on SugarSync, and get the direct download link to download…
Bennybear
  • 335
  • 2
  • 13
0
votes
1 answer

JSONSerialization returns an error, but php parcer

I am receiving a JSON string from the server and it looks like this: [[{\"type\":\"action\",\"action\":\"courier_on_map\",\"text\":\"\\u0421\\u043c\\u043e\\u0442\\u0440\\u0435\\u0442\\u044c \\u043d\\u0430…
Eduard
  • 516
  • 1
  • 4
  • 17
0
votes
2 answers

How to pass settings to Nservicebus JsonSerializer in C#?

Based on https://docs.particular.net/nservicebus/serialization/json, I would like to pass some settings to the JsonSerializer, such as IgnoreNullValues for example. But so far I didn't find out any example of how to pass settings to the…
znn
  • 459
  • 7
  • 15
0
votes
1 answer

C# How to deserialize nested Json data

I have a Json data with two fields which are ID and Content. Content will store another Json data. I want to deserialize the first (outer side) Json only. Is it possible to do…
0
votes
1 answer

Symfony2 - entities with relationships as json response

I am trying to create efficient JSON Response controllers for AJAX. So far, instead of passing whole entity to JsonResponse I am creating arrays with necessary data inside where I can easily manage output data leaving less work for JavaScript. My…
Ignas Damunskis
  • 1,515
  • 1
  • 17
  • 44
0
votes
2 answers

JSON ObjectMapper in Flutter

I'd like to have objects serialized/deserialized from JSON in Flutter. I know I can use JsonDecoder from json.dart which gives me string-key based LinkedHashMap but I'm more interested in ObjectMapper approach so that I'm able to get typed response…
0
votes
1 answer

receive abstract type in WebAPI as input

I have the following WebAPI action insed a controller (example): public MyAbstractClass Action1(MyAbstractClass input) { return input; } the class structure is like so: public class MyAbstractClass { public int ID {get;set;} public…
Mortalus
  • 10,574
  • 11
  • 67
  • 117