Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gson Serializer for Skygear Record
package org.astri.isns.elderly;
import com.google.gson.JsonElement;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import java.lang.reflect.Type;
import java.util.Map;
import io.skygear.skygear.Record;
/**
* Created by funglam on 2/21/17.
*/
public class RecordSerializer implements JsonSerializer<Record> {
public JsonElement serialize(Record src, Type typeOfSrc, JsonSerializationContext context) {
Map<String, Object> root = src.getData();
Map<String, Object> firstLevel = src.getTransient();
root.putAll(firstLevel);
return context.serialize(root);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.