Looks like you can pass a Hamcrest Matcher instead of a string there. Should be something like:
mockMvc.perform(get("/api/users/" + id))
.andExpect(status().isOk())
.andExpect(content().string(org.hamcrest.Matchers.containsString("{\"id\":\"" + id + "\"}")));