Skip to content

Instantly share code, notes, and snippets.

@jnizet
Created July 15, 2018 09:21
Show Gist options
  • Save jnizet/d1d539da7d6be035edba4124d594aef7 to your computer and use it in GitHub Desktop.
Save jnizet/d1d539da7d6be035edba4124d594aef7 to your computer and use it in GitHub Desktop.
package com.bar.grrr;
import java.io.IOException;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
public class ABC {
@JsonProperty("class")
private String clazz;
public static void main(String[] args) throws IOException {
String json = "{\n" +
" \"class\": \"foo\"\n" +
"}";
ObjectMapper objectMapper = new ObjectMapper();
ABC abc = objectMapper.readValue(json, ABC.class);
System.out.println("abc.clazz = " + abc.clazz);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment