title: How to convert json array to json object in lambda python function
body: <p>How to convert json array to json object in lambda python function, Below is my lambda code:</p>
  
  <pre><code>import sys
  import logging
  import pymysql
  import json
  rds_host=".com"
  name="name"
  password="pass"
  db_name="DB"
  port = 3306
  def save_events(event):
  result = []
  conn = pymysql.connect(rds_host, user=name, passwd=password, db=db_name, 
  connect_timeout=30)
  with conn.cursor() as cur:
    cur.execute("select * from bodyPart")
  for row in cur:
    result.append(list(row))
  print ("Data from RDS...")
  print (result)
  cur.close()
  bodyparts = json.dumps(result)
  
  def lambda_handler(event, context):
    save_events(event)
    return bodyparts
  </code></pre>
  
  <p>Below is the output
  Response:</p>
  
  <pre><code>[[1, \"Chest\", \"link"], [2, \"Shoulder\", 
  null], [3, \"Arms\", null]]
  </code></pre>
  
  <p>How to get a response like </p>
  
  <pre><code> {id='1',
   name='chest',
   link='......', ....}
  </code></pre>