Support for json as array

I needed to present a large list of options and preserve server-side ordering.

With this patch, json may be either an array of [key, value] tuples, or an object of {key: value}.