Add eco_scenario.json endpoint to support modeling

I factored some code out of the eco.json endpoint to keep things DRY.
While moving the code I added more descriptive error messages for the
different failure modes, to help with debugging.

I renamed some of the generically named structures used for JSON
marshaling so that they are more specific about their contents and the
endpoints to which they are related.