Walk the fields of message and invoke encodeValue on each that should be written as JSON. This omits fields that have the identity value when that is required.