Hi Matthew, Which Spark version are you using? The expression `to_json` was added in 2.2 with this commit: https://github.com/apache/spark/commit/0cdcf9114527a2c359c25e46fd6556b3855bfb28
Best, Burak On Sun, Jul 16, 2017 at 6:24 PM, Matthew cao <cybea...@gmail.com> wrote: > Hi all, > I just read the databricks blog here: https://docs.databricks. > com/_static/notebooks/complex-nested-structured.html > > When I try to follow the example about the to_json and selectExpr part, it > gave error: “org.apache.spark.sql.AnalysisException: Undefined function: > 'to_json'. This function is neither a registered temporary function nor a > permanent function registered in the database 'default'.; line 1 pos 0”. > Also this error show in the original databricks notebook. I know that > to_json function works great with select. Do I miss something when using > selectExpr? THX. > > Best, > Matthew > >