break out categoryTreeFromJSON so that we can use it from ShopSense

@aprato can you take a look?