now has JSON data as follows
{\"Id\":11,\"data\":[{\"package\":\"com.browser1\",\"activetime\":60000},{\"package\":\"com.browser6\",\"activetime\":1205000},{\"pa
with @Shankar Koirala 's help , I learned how to use ' explode' to handle joson array.
val df = sqlContext.sql("SELECT data FROM behavior") appActiveTime.select(explode(df("data"))).toDF("data") .select("data.package","data.activetime") .show(false)