Convert CSV data to JSON with header

I need to convert CSV data to JSON format with header on it

I tried below

  • df.write.mode(“overwrite”).json(path)

Please advise

Did what you tried produce an error message, unexpected behavior, or what?

It looks like you’re using some libraries… what are they?