'How to convert some columns to a JSON string (SQL)

I'm working with Amazon's Glue service and I need to convert some columns to a JSON string. Is this possible with a SQL query (more specifically spark SQL)?

Example Table

a | b | c

1a 2b 3c

Expected output:


a | json_string

1a '{"b":"2b", "c": "3c"}'



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source