Questions tagged [unmarshalling]

Unmarshalling is the process of transforming the storage or transmission representation of an object back into its original memory representation. It is the inverse of marshalling.

Unmarshalling is the process of transforming the storage or transmission representation of an object back into its original memory representation. It is the inverse of marshalling.

Unmarshalling is the same as Deserialization that is known in .NET and Java.

1932 questions
73
votes
6 answers

javax.xml.bind.UnmarshalException: unexpected element. Expected elements are (none)

I am getting this error, while unmarshalling a string. I have created Java files using JAXB. JAXBContext jaxbContext = JAXBContext.newInstance(DocumentType.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); // Input string posted…
user3102817
  • 753
  • 1
  • 5
  • 5
68
votes
3 answers

JAXB: How to marshal objects in lists?

Perhaps a stupid question: I have a List of type which I want to marshal into a XML file. This is my class Database containing an ArrayList... @XmlRootElement public class Database { List records = new ArrayList(); public…
rmv
  • 3,195
  • 4
  • 26
  • 29
68
votes
8 answers

Android E/Parcel﹕ Class not found when unmarshalling (only on Samsung Tab3)

I've been unable to resolve why this error occurs, and only on a Samsung Tab3 device, running 4.4.2? It happens when my MainActivity starts another Activity, and passes a Parcelable class in the intent like so: private void…
63
votes
3 answers

Cannot unmarshal string into Go value of type int64

I have struct type tySurvey struct { Id int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` } I do json.Marshal write JSON bytes in HTML page. jQuery modifies name field in object and encodes object…
Max
  • 6,286
  • 5
  • 44
  • 86
56
votes
4 answers

"BadParcelableException: ClassNotFoundException when unmarshalling " while using Parcel.read method that has a ClassLoader as argument

Given a custom class org.example.app.MyClass implements Parcelable, I want to write a List to a Parcel. I did the marshalling with List myclassList = ... parcel.writeList(myclassList); whenever I try to unmarshall the class…
Flow
  • 23,572
  • 15
  • 99
  • 156
48
votes
2 answers

How to marshall and unmarshall a Parcelable to a byte array with help of Parcel?

I want to marshall and unmarshall a Class that implements Parcelable to/from a byte array. I am well aware of the fact that the Parcelable representation is not stable and therefore not meant for long term storage of instances. But I have a use case…
Flow
  • 23,572
  • 15
  • 99
  • 156
46
votes
12 answers

How to fix Unmarshalling unknown type code XXX at offset YYY in Android?

I'm having app crash on resume because of Unmarshalling exception. I've checked all the Serializables have constructor with no parameters and even checked all the serializables using ObjectStream (save to file and load from file). How can i…
4ntoine
  • 19,816
  • 21
  • 96
  • 220
39
votes
5 answers

Unmarshal CSV record into struct in Go

The problem how to automatically deserialize/unmarshal record from CSV file into Go struct. For example, I have type Test struct { Name string Surname string Age int } And CSV file contains records John;Smith;42 Piter;Abel;50 Is there an…
Valentyn Shybanov
  • 19,331
  • 7
  • 66
  • 59
32
votes
2 answers

How to unmarshal JSON into durations?

What is the idiomatic way to unmarshal into time.Duration in Go? How can I make use of time.ParseDuration?
user6216224
32
votes
4 answers

Is there a package to marshal in and out of x-www-form-urlencoding in golang

I would like to marshal in and out of x-www-form-urlencoding similar to how you can do it with json or xml. Is there an existing package to do this, or are there any documents on how to implement one myself if none exist?
placeybordeaux
  • 2,138
  • 1
  • 20
  • 42
32
votes
5 answers

when does JAXB unmarshaller.unmarshal returns a JAXBElement or a MySchemaObject?

I have two codes, in two different java projects, doing almost the same thing, (unmarshalling the input of a webservice according to an xsd-file). But in one case I should write this: (Input is a placeholder name) ( element is OMElement input…
Stephane Rolland
  • 38,876
  • 35
  • 121
  • 169
30
votes
4 answers

JAXB - Ignore element

Is there any way to just ignore an element from Jaxb parsing? I have a large XML file, and if I could ignore one of the large, complex elements, then it would probably parse a lot quicker. It would be even better if it could not even validate the…
questioner
  • 775
  • 4
  • 9
  • 15
30
votes
4 answers

Golang json Unmarshal "unexpected end of JSON input"

I am working on some code to parse the JSON data from an HTTP response. The code I have looks something like this: type ResultStruct struct { result []map[string]string } var jsonData ResultStruct err = json.Unmarshal(respBytes, &jsonData) The…
Stratus3D
  • 4,648
  • 4
  • 35
  • 67
28
votes
4 answers

panic: json: cannot unmarshal array into Go value of type main.Structure

What are you trying to accomplish? I am trying to parse data from a json api. Paste the part of the code that shows the problem. package main import ( "encoding/json" "fmt" "io/ioutil" "net/http" ) type Structure…
Peter S
  • 827
  • 1
  • 8
  • 24
28
votes
1 answer

json.Unmarshal returning blank structure

I have a JSON blob that looks like this { "metadata":{ "id":"2377f625-619b-4e20-90af-9a6cbfb80040", "from":"2014-12-30T07:23:42.000Z", "to":"2015-01-14T05:11:51.000Z", "entryCount":801, "size":821472, …
Kevin
  • 750
  • 2
  • 10
  • 20
1
2 3
99 100