Questions tagged [serialization]

Serialization is the process by which data-structures are converted into a format that can be easily stored or transmitted and subsequently reconstructed.

Serialization is the process of converting a or object's state into a format that can be stored (for example, in a flat file or memory ) or transmitted over a network, to be reconstructed later maintaining data integrity - typically in a different run-time environment which may or may not be on the same computer.

The process of serializing an object is sometimes referred to as - however depending on the context / language this term may take on a slightly different meaning. The process of reconstructing a data structure from its serialized form is known as .

Popular formats for serialization are and .

33160 questions
11
votes
1 answer

Writing a Large JSON Array To File

I am working on a process that will likely end up attempting to serialize very large json arrays to file. So loading up the entire array in memory and just dumping to file won't work. I need to stream the individual items to file to avoid out of…
user163757
  • 6,795
  • 9
  • 32
  • 47
11
votes
7 answers

Serializing a javascript class object?

The requirement is simple. Here's a class... class myobj { constructor(var1, var2) { this.var1 = var1; this.var2 = var2; } addThemUp() { return this.var1 + this.var2; } } Now I make one of these... var…
IamPancakeMan
  • 199
  • 1
  • 10
11
votes
1 answer

Spark - Serializing an object with a non-serializable member

I am going to ask this question in the context of Spark, because that's what I'm facing, but this might be a plain Java issue. In our spark job, we have a Resolver which needs to be used in all of our workers (it's used in a udf). The problem is…
summerbulb
  • 5,709
  • 8
  • 37
  • 83
11
votes
3 answers

c# stream received all data?

I'm using C#.Net and the Socket class from the System.Net.Sockets namespace. I'm using the asynchronous receive methods. I understand this can be more easily done with something like a web service; this question is borne out of my curiosity rather…
user47589
11
votes
3 answers

Why does ActionSupport implement Serializable

What is the need for Action classes to be serializable? When and how does it happen, if at all.
sengs
  • 6,647
  • 6
  • 30
  • 24
11
votes
2 answers

Serialize Array without root element

I'm trying to get to this result while serializing XML C:\test.txt 1
Khoumbe
  • 111
  • 1
  • 4
11
votes
5 answers

Anyway to get JsonConvert.SerializeObject to ignore the JsonConverter attribute on a property?

I have a class that I cannot change: public enum MyEnum { Item1 = 0, Item2 = 1 } public class foo { [JsonConverter(typeof(StringEnumConverter))] public MyEnum EnumTypes {get; set; } } Somewhere down the line…
AngryHacker
  • 59,598
  • 102
  • 325
  • 594
11
votes
2 answers

How to serialize(JSON) FileField in Django

I am new to Django and trying to build an app to test out few things for my project. I want to read the form - do some validation and then send the input to another module (say a scheduler running separately). The scheduler rest api will be called…
yguw
  • 856
  • 6
  • 12
  • 32
11
votes
2 answers

How to serialize a Lookup object into JSON?

I'm trying to serialize a Lookup into JSON by doing: Lookup productIdsByCategory = prodcuts.ToLookup(p => p.Category, p => p.Id); Then in my ASP.NET Core WebAPI controller i'm returning by doing: var response = new ComplexType { …
Jonas
  • 3,155
  • 5
  • 35
  • 55
11
votes
3 answers

How to serialize non-static child class of static class

I want to serialize a pretty ordinary class, but the catch is it's nested in a static class like this: public static class StaticClass { [Serializable] public class SomeType { ... } } This code: StaticClass.SomeType obj =…
tenfour
  • 36,141
  • 15
  • 83
  • 142
11
votes
3 answers

Renaming model association attributes in Rails JSON serialization?

I have an existing Rails 3 application, to which I am adding a JSON API. We have a Vendor ActiveRecord model, and an Employee ActiveRecord model. An Employee belongs to a Vendor. In the API, we want to include an Employee's Vendor in the JSON…
thefugal
  • 1,214
  • 1
  • 10
  • 18
11
votes
2 answers

boost serialization exception: unregistered class, serializing polymorphic base problem

i've been reading, cross-referencing, and ultimately not finding a coherent example and answer. what i'm trying to do is pretty simple, but i'm clearly missing something. in english, i've got a class structure with two abstract bases (pure BB…
mysticbob
  • 111
  • 1
  • 1
  • 4
11
votes
8 answers

StackOverflowError when serializing an object in Java

I am writing an application in Java using Swing. I am trying to implement functionality to save and load simulation states for at simulation i am running. The entire simulation is kept as an object, disconnected from Swing. I am trying to serialize…
utdiscant
  • 11,128
  • 8
  • 31
  • 40
11
votes
3 answers

Spring deserializes a LocalDate in a @RequestBody differently from one in a @RequestParam - why, and can they be the same?

QUESTION: Spring appears to use different deserialization methods for LocalDate depending on whether it appears in a @RequestBody or a request @ReqestParam - is this correct, and if so, is there a way to configure them to be the same throughout an…
drew
  • 2,949
  • 3
  • 25
  • 27
11
votes
5 answers

JMS Serializer: how to use camel case for properties

I'm using FOS Rest bundle and JMS Serializer to create a REST Api. The problem is I would like to keep the property names in the JSON response camel cased instead of using _. For example, I have a property called employeeIdentifier, by default that…
petekaner
  • 8,071
  • 5
  • 29
  • 52