public Preset unmarshall(JsonUnmarshallerContext context) throws Exception { Preset preset = new Preset(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.currentToken; if (token == null) token = context.nextToken(); while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("Id", targetDepth)) { context.nextToken(); preset.setId(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("Name", targetDepth)) { context.nextToken(); preset.setName(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("Description", targetDepth)) { context.nextToken(); preset.setDescription(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("Container", targetDepth)) { context.nextToken(); preset.setContainer(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("Audio", targetDepth)) { context.nextToken(); preset.setAudio(AudioParametersJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("Video", targetDepth)) { context.nextToken(); preset.setVideo(VideoParametersJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("Thumbnails", targetDepth)) { context.nextToken(); preset.setThumbnails(ThumbnailsJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("Type", targetDepth)) { context.nextToken(); preset.setType(StringJsonUnmarshaller.getInstance().unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return preset; }