Format object with key value

There is an example of something similar here.