Basic JSON normalization/flattening

Related to discussion in #1067. This isn't a fast function but has quite a bit of functionality. Take a look at the unit tests. Comments on the API welcome and this could use a few iterations. Various ad hoc things like concatenating "key paths" to metadata