Write a function to handle data transformation from a nested JSON structure into a tabular format.
Implement flatten_json(data), where data is a list of JSON objects. Flatten nested objects by joining keys with ., and expand arrays of objects into separate rows. If multiple arrays occur in one object, produce the Cartesian product of their elements. Arrays of scalar values remain in a single cell. Return a list of dictionaries, with absent fields omitted.
The input contains JSON-compatible dictionaries, lists, strings, numbers, booleans, and null values. Preserve scalar values without conversion.
def flatten_json(data):