-
-
Save push-gists/23de3557bbdac83509e717e4829be04c to your computer and use it in GitHub Desktop.
Convert a JSON value to a map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Construct the Jackson factory objects | |
final CBORFactory factory = new CBORFactory(); | |
final ObjectMapper mapper = new ObjectMapper(factory); | |
// Create a CBOR parse for the JSON value | |
final CBORParser parser = factory.createParser(json.asInputStream()); | |
// Bind the value as a map | |
final Map<String, Object> value = mapper.readValue(parser, new TypeReference<Map<String, Object>>() { }); | |
// Close the parser | |
parser.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment