use of com.google.gson.JsonStreamParser in project commons by twitter.
the class TTextProtocol method readMapBegin.
@Override
public TMap readMapBegin() throws TException {
getCurrentContext().read();
JsonElement curElem = getCurrentContext().getCurrentChild();
if (getCurrentContext().isMapKey()) {
curElem = new JsonStreamParser(curElem.getAsString()).next();
}
if (!curElem.isJsonObject()) {
throw new TException("Expected JSON Object!");
}
pushContext(new MapContext(curElem.getAsJsonObject()));
return new TMap(UNUSED_TYPE, UNUSED_TYPE, curElem.getAsJsonObject().entrySet().size());
}
Aggregations