build up an attribute hash and dump to json