Sign up ×

I have heard this concept used frequently, but I don't have a really good grasp of what it is.

share|improve this question
you really should add a little more to this, such as the context you are looking for. Example, one example: marshalling in .net is the process of translating data from managed types to unmanaged types for crossing boundaries. It could be used i n several other contexts as well. – mattlant Sep 30 '08 at 17:52
@mattlant: Marshalling means the same thing in every instance. Those are just different implementations. – GEOCHET Sep 30 '08 at 17:54

9 Answers 9

up vote 21 down vote accepted

Converting an object in memory into a format that can be written to disk, or sent over the wire, etc.

Wikipedia's description.

share|improve this answer
Apparently that's the definition of 'serialization'; 'marshalling' is slightly different:… – Steph Thirion Jul 28 '11 at 21:18
@StephThirion Do you mean an Object, if unserialized, can just have state, there won't be any codebase i.e. none of its function can be called, it is just a structured data type. And, if the same object is marshalled then it will have its codebase along with structure and one can call its functions? – bjan Mar 8 '14 at 4:47

I beg to differ, Wikipedia is pretty clear on this.

In computer science, marshalling (similar to serialization) is the process of transforming the memory representation of an object to a data format suitable for storage or transmission. It is typically used when data must be moved between different parts of a computer program or from one program to another.

share|improve this answer
What are you disagreeing with? – Brian Webster Jun 16 '11 at 1:21
The definition may slightly vary depending on the context, however. – david Dec 6 '11 at 15:37
@david: Defintion != implementation. – GEOCHET Dec 6 '11 at 19:24

People have defined marshalling quite clearly already, so I'll skip the definition and jump to an example.

Remote procedure call uses marshalling. When invoking remote functions you will have to marshall the arguments to some kind of standard format so it can be transport across the network.

share|improve this answer

I clarified a google search to "data marshalling" and the first hit was on some place called webopedia which is pretty good. The gist is that you transform data back and forth to a form for things like transmission over a network. The problem it solves is that you can't really transmit data over a network in a form that is usable by a program. You have to solve a number of issues including things like endianness of data, how you store complex data types like strings, etc.

Marshalling is not just to solve network transmission problems but other problems such as going from one architecture to another, maybe different languages especially those that might use things like virtual machines, and other "translation" problems.

share|improve this answer

Marshalling is the process of transforming the memory representation of an object to a data format that could be stored or transmitted. It's also called serialization (although it could be different in certain contexts). The memory representation of the object could be stored as binary or XML or any format suitable for storage and/or transmission in a way that allows you to unmarshal it and get the original object back.

For an example of usage, if you have some online game with a client and server components and you wanted to send the player object containing player stats and world coordinates from the client to the server (or the other way around), you could simply marshal it at the client, send it over the network, and unmarshal it at the other end and it would appear for the server as if the object was created on the server itself. Here's a ruby example:

srcplayer =
# marshal (store it as string)
str = Marshal.dump(srcplayer)
#unmarshal (get it back)
destplayer = Marshal.load(str)
share|improve this answer

Basically it's an expression for generically transforming an object (or similar) into another representation that (e.g.) can be sent over the wire or stored to disk (typically string or binary stream. The opposite, unmarshalling, describes the opposite direction of reading the marshalled representation and re-creating an object or whatever in-memory-structure existed earlier.

Another current everyday example is JSON

share|improve this answer

Marshalling is the process of transferring data across application boundaries or between different data formats. Marshalling is very common, for example writing data to disk or to a database is technically marshalling, however the term tends to be used to describe data conversion for "foreign" APIs or for interprocess communication.

For example, in .NET, communicating between managed and unmanaged code (such as accessing certain win32 APIs) will likely require marshalling in order to convert back and forth between managed C# objects and C/C++ style objects (structs, handles, output buffers, etc.) The help for the static Marshal class might be helpful.

share|improve this answer

In a very generic sense in programming it simply means taking data in one format and transforming it into a format that is acceptable by some other sub-system.

share|improve this answer

It means turning any data into another data type to transfer to another system.

E.g., marshalling a struct into an XML document to send to the webservice, or marshalling a pointer to send to a different thread apartment.

share|improve this answer

Your Answer


