相关疑难解决方法(0)

如何使用GSON或Java中的其他JSON库反序列化列表?

我可以在GAE上序列化我的servlet中的List,但我不能反序列化它.我究竟做错了什么?

这是我在GAE中的视频类,它是序列化的:

package legiontube;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Video {

    @PrimaryKey
    private String id;

    @Persistent
    private String titulo;

    @Persistent
    private String descricao;

    @Persistent
    private Date date;

    public Video(){};

 public Video(String id, String titulo, String descricao, Date date) {
  //super();
  this.id = id;
  this.titulo = titulo;
  this.descricao = descricao;
  this.date = date;
 }

 public String getId() {
  return id;
 }

 public void setId(String id) {
  this.id = id; …
Run Code Online (Sandbox Code Playgroud)

java json gson

106
推荐指数
3
解决办法
10万
查看次数

标签 统计

gson ×1

java ×1

json ×1