Code Room
Code reviewHardcr-g330
Subject SerializationLevel Senior–Staff~20 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Java code that reads a Snowflake-style 64-bit ID out of an inbound JSON payload with Jackson's tree model.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewjava
ObjectMapper mapper = new ObjectMapper(); long parseId(String json) throws Exception {    JsonNode root = mapper.readTree(json);    // json is like {"id": 1541815603606036480}    double v = root.get("id").asDouble();    return (long) v;}
Run or narrate your approach, then ask the coach.