Changed JSON encoding to use associative arrays.