Skip to content

Instantly share code, notes, and snippets.

@push-gists
Last active May 5, 2016 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save push-gists/23de3557bbdac83509e717e4829be04c to your computer and use it in GitHub Desktop.
Save push-gists/23de3557bbdac83509e717e4829be04c to your computer and use it in GitHub Desktop.
Convert a JSON value to a map
// 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