Explain how you would extract and transform nested JSON data from an S3 bucket into a relational format for analytics.