title: pyspark add a column in dataframe with json
body: <p>I have a dataframe df3 :-</p>
  
  <p>test_df3.show()</p>
  
  <pre><code>+----------------------+-------------------+
  
  |count(user_name)|count(team_id)|
  
  +----------------------+-------------------+
  
  | 10 | 10|
  
  +----------------------+-------------------+
  </code></pre>
  
  <p>I need to create a json from above two columns &amp; add to it to a new column</p>
  
  <pre><code>udf = UserDefinedFunction(lambda x,y: {"user_count":x, "team_count":y}, StringType())
  </code></pre>
  
  <p>above I am taking StringType as json_type is not available,</p>
  
  <pre><code>test_df3 = test_df3.withColumn("new",udf(col("count(user_name)"), col("count(team_id)"))).select("new")
  </code></pre>
  
  <h1>Any help about how to get json in dataframe column.</h1>