I am using the Jackson JSON Lib in Java to process JSON. If you don’t know how JSON works in Ruby, you will like this project. Anyway. If you have dynamic JSON stream where the property names are not always the same, than you need the “@JsonAnySetter” Annotation. With that you can map dynamic Properties to a map.

private Map<String, Object> all = new HashMap<String, Object>();

public void set(String name, Object value) {
   all.put(name, value);

public Map<String, Object> getAll() {
   return all;

public void setAll(Map<String, Object> all) {
   this.all = all;

That worked out for me, for a String – String pair.

Published by Robert Reiz

CEO @ VersionEye. Passionated software developer since 1998.

One thought on “JsonAnySetter

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: