Add activity_type_id to case_type api output

The original code did use json_encode(json_decode()) at a higher-level (like your snippet). It didn't work consistently across these scenarios:
 * Omitting <ActivityTypes>
 * Defining <ActivityTypes> without any <ActivityType>s
 * Defining <ActivityTypes> with a single <ActivityType>
 * Defining <ActivityTypes> with multiple <ActivityType>s

This turned on some subtleties with how SimpleXMLElement figures out when to use an array. It was easier on my mind to just write a for loop.

Your snippet might be a little different from the original -- maybe it works. If it passes the tests, then it works. ;)