pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vanio Meurer <vani...@gmail.com>
Subject Re: How parse a JSON to List<Bean>
Date Mon, 31 Jan 2011 17:38:02 GMT

In those tests we don't have anyone testing the java.util.Date class.
It's will work fine too?
I'm getting this exception:

An error occurred while processing input at line number 1
org.apache.pivot.web.QueryException: 500
org.apache.pivot.serialization.SerializationException: Could not determine
sequence item type.
	at org.apache.pivot.web.Query.execute(Query.java:489)
	at org.apache.pivot.web.GetQuery.execute(GetQuery.java:53)
	at org.apache.pivot.util.concurrent.Task$ExecuteCallback.run(Task.java:42)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.pivot.serialization.SerializationException: Could not
determine sequence item type.
	at
org.apache.pivot.json.JSONSerializer.readListValue(JSONSerializer.java:598)
	at org.apache.pivot.json.JSONSerializer.readValue(JSONSerializer.java:303)
	at org.apache.pivot.json.JSONSerializer.readObject(JSONSerializer.java:273)
	at org.apache.pivot.json.JSONSerializer.readObject(JSONSerializer.java:232)
	at org.apache.pivot.web.Query.execute(Query.java:474)
	... 6 more

Using:
GetQuery get = new GetQuery("localhost", 8888, "/person", false);
get.setSerializer(new JSONSerializer((new
TypeLiteral<java.util.ArrayList<Person>>(){}).getType()));

The JSON is ok:
[{firstName: "Vânio", lastName: "Meurer", dateOfBirth: {date: 5, time:
1294185600000, hours: 0, minutes: 0, month: 0, seconds: 0, year: 111},
foreign: true, id: 1, height: 1.96, weight: 80.0}, {firstName: "Agora",
lastName: "Sim", dateOfBirth: {date: 25, time: 1295913600000, hours: 0,
minutes: 0, month: 0, seconds: 0, year: 111}, foreign: false, id: 2, height:
2.0, weight: 2.0}, {firstName: "Agora Vai", lastName: "Haha", dateOfBirth:
{date: 25, time: 1295913600000, hours: 0, minutes: 0, month: 0, seconds: 0,
year: 111}, foreign: false, id: 3, height: 3.0, weight: 3.0}, {firstName:
"sim", lastName: "sxx", dateOfBirth: {date: 25, time: 1295913600000, hours:
0, minutes: 0, month: 0, seconds: 0, year: 111}, foreign: false, id: 4,
height: 12.0, weight: 12.0}, {firstName: "dsd", lastName: "adasd",
dateOfBirth: {date: 25, time: 1295913600000, hours: 0, minutes: 0, month: 0,
seconds: 0, year: 111}, foreign: false, id: 5, height: 22.0, weight: 2.0},
{firstName: "Giselly", lastName: "Felippe", dateOfBirth: {date: 27, time:
1296086400000, hours: 0, minutes: 0, month: 0, seconds: 0, year: 111},
foreign: false, id: 6, height: 12.0, weight: 11.0}]
-- 
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/How-parse-a-JSON-to-List-Bean-tp2374783p2390132.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Mime
View raw message