serialization Questions

8

Solved

I have a case where the values for a serializer field depend on the identity of the currently logged in user. I have seen how to add the user to the context when initializing a serializer, but I am...
Uncommon asked 24/6, 2015 at 23:19

1

Solved

I am just trying to create serializable values but i am getting the following error; Serializer has not been found for type 'LocalDate'. To use context serializer as fallback, explicitly annotate t...
Cohette asked 29/8, 2023 at 16:41

6

Solved

I have a form that has two buttons. One for saving a record and the other for cancelling the save procedure. I am using the rails.js (a common AJAX/jQuery plug-in for those of you not in the know) ...
Erlineerlinna asked 24/10, 2010 at 11:0

3

I have some C# code using ASP.Net MVC, which is making use of Json.Net to serialize some DTOs. In order to reduce payload, I have made use of the [JsonProperty(PropertyName = "shortName")] attribut...
Schuh asked 16/12, 2013 at 22:44

4

Solved

I am trying to restrict one field in a class to an enum. However, when I try to get a dictionary out of class, it doesn't get converted to string. Instead it retains the enum. I checked pydantic do...
Antimicrobial asked 9/12, 2020 at 2:50

2

Solved

I am writing a custom System.Text.Json.JsonConverter<T> to upgrade an old data model to a new version. I have overridden Read() and implemented the necessary postprocessing. However, I don't ...
Toque asked 23/12, 2020 at 20:15

4

I'm working with the Microsoft ASP.NET Web API Client Libraries (version 4.0.30506 since I have to run on .NET Framework 4.0) to interface with a .NET web API. I have confirmed that the data is bei...
Peritonitis asked 24/4, 2014 at 21:54

7

Solved

I have a Grails service that sends out e-mails using a 3rd-party service by doing a HTTP call: class EmailService { def sendEmail(values) { def valueJson = values as JSON ... // does HTTP call ...
Frae asked 2/8, 2012 at 21:0

7

Solved

I've got some files in the relative directory (directory the app is running in) starting with '@' and I need to open all of them in java. Show me a way to accomplish it. If it helps, I'm working on...
Farias asked 15/4, 2011 at 20:23

7

Solved

I have a list of objects and I need to save that somewhere in my computer. I have read some forums and I know that the object has to be Serializable. But it would be nice if I can get an example. F...
Violoncello asked 24/5, 2011 at 19:22

7

Solved

I have heard that Json.NET is faster than DataContractJsonSerializer, and wanted to give it a try... But I couldn't find any methods on JsonConvert that take a stream rather than a string. For ...
Merrilee asked 16/11, 2011 at 19:41

12

Solved

Is this a correct approach to convert ByteBuffer to String in this way, String k = "abcd"; ByteBuffer b = ByteBuffer.wrap(k.getBytes()); String v = new String(b.array()); if(k.equals(v)) System....
Tetrabrach asked 27/6, 2013 at 23:27

6

Solved

I have the following serializable class (implements serializable): public class Test implements Serializable{ private String id; private Map<String,Object> otherProperties; } However , ...
Scrutable asked 9/12, 2019 at 16:20

4

Solved

I'm writing a JsonConverter to perform some conversion tasks I need accomplished on read/write. In particular, I'm taking the existing serialization behavior and tacking on some additional properti...
Recovery asked 18/4, 2013 at 14:33

15

Solved

On a global level in .NET Core 1.0 (all API responses), how can I configure Startup.cs so that null fields are removed/ignored in JSON responses? Using Newtonsoft.Json, you can apply the following...
Agential asked 16/6, 2017 at 17:35

2

Solved

I am attempting to create a class object and use Invoke-Command to call a function on the class on a remote machine. When I use Invoke-Command with no computer name this works fine but when I attem...
Ellipticity asked 24/1, 2020 at 15:25

3

Solved

I have a class with a property of type List<SomeEnum>. Something like this: public enum MyEnum { A, B } public class MyClass { public string Id { get; set; } public List<MyEnum> V...
Valentia asked 15/11, 2017 at 16:50

6

Solved

I have a class with a nullable int? datatype set to serialize as an xml element. Is there any way to set it up so the xml serializer will not serialize the element if the value is null? I've tried ...
Dyun asked 28/10, 2008 at 21:33

6

Solved

json.net (newtonsoft) I am looking through the documentation but I can't find anything on this or the best way to do it. public class Base { public string Name; } public class Derived : Base { p...
Seif asked 14/12, 2011 at 23:7

6

Solved

Some APIs, like the paypal API use a string type in JSON to represent a decimal number. So "7.47" instead of 7.47. Why/when would this be a good idea over using the json number value type? AFAIK ...
Daffi asked 29/2, 2016 at 21:3

2

Solved

I used a Dictionary in a Web API project, which is serializing like that in JSON: {"keyname":{objectvalue},"keyname2:".... Since I have duplicate keys I could't use Dictionary type any more, and...
Klong asked 9/1, 2014 at 13:31

3

I'm writing a Python app for serializing and sending protobuf3 messages. I'd like to make some sort of interactive UI that allows to choose a message and assign it on the fly. I've got a pretty big...
Terror asked 26/7, 2019 at 14:42

2

Working on spark, sometimes I need to send a non-serializable object in each task. A common pattern is @transient lazy val, e.g class A(val a: Int) def compute(rdd: RDD[Int]) = { // lazy val in...

4

Solved

I wish to save a random Vim dictionnary, let's say: let dico = {'a' : [[1,2], [3]], 'b' : {'in': "str", 'out' : 51}} to a file. Is there a clever way to do this? Something I could use like: cal...
Vanir asked 10/7, 2015 at 19:24

9

Solved

I have a requirement to map all of the field values and child collections between ObjectV1 and ObjectV2 by field name. ObjectV2 is in a different namspace to ObjectV1. Inheritence between the tem...
Saprophagous asked 20/2, 2009 at 11:8

© 2022 - 2024 — McMap. All rights reserved.