title: how to convert <class 'bs4.element.ResultSet'> to JSON in python using builtin operator json.dumps
body: <p>how do i convert  to json format, </p>
  
  <p>i am getting an error  "is not JSON serializable"</p>
  
  <p>following is my program</p>
  
  <pre><code>from urllib2 import urlopen as uReq
  import re
  from bs4 import BeautifulSoup, Comment
  import requests
  import json
  my_url='https://uae.dubizzle.com/en/property-for-rent/residential/apartmentflat/?filters=(neighborhoods.ids=123)&amp;amp;page=1'
  
  uClient=uReq(my_url)
  page_html= uClient.read()
  page_soup=BeautifulSoup(page_html, 'html.parser')
  comments = page_soup.findAll(text=lambda text:isinstance(text, Comment))
  [comment.extract() for comment in comments]
  json_output= page_soup.find_all("script",type="application/ld+json",string=re.compile("SingleFamilyResidence")) #find_all("script", "application/ld+json")
  #comments = json_output.findAll(text=lambda text:isinstance(text, Comment))
  #[comment.extract() for comment in comments]
  #json_output.find_all(text="&lt;script type=""application/ld+json""&gt;").replaceWith("")
  #print json_output
  jsonD = json.dumps(json_output)
  uClient.close()
  </code></pre>
  
  <p>[{"@context":"<a href="http://schema.org" rel="nofollow noreferrer">http://schema.org</a>","@type":"SingleFamilyResidence","name":"Spacious 2BHK For Rent in Damascus Street Al Qusais","url":"<a href="https://dubai.dubizzle.com/property-for-rent/residential/apartmentflat/2018/4/29/spacious-two-bed-room-available-for-rent-i-2/" rel="nofollow noreferrer">https://dubai.dubizzle.com/property-for-rent/residential/apartmentflat/2018/4/29/spacious-two-bed-room-available-for-rent-i-2/</a>","address":{"@type":"PostalAddress","addressLocality":"Dubai","addressRegion":"Dubai"},"":{"@type":"Product","name":"Spacious 2BHK For Rent in Damascus Street Al Qusais","url":"<a href="https://dubai.dubizzle.com/property-for-rent/residential/apartmentflat/2018/4/29/spacious-two-bed-room-available-for-rent-i-2/" rel="nofollow noreferrer">https://dubai.dubizzle.com/property-for-rent/residential/apartmentflat/2018/4/29/spacious-two-bed-room-available-for-rent-i-2/</a>","offers":{"@type":"Offer","price":49000,"priceCurrency":"AED"}},"floorSize":1400,"numberOfRooms":2,"image":"<a href="https://dbzlpvfeeds-a.akamaihd.net/images/user_images/2018/04/29/80881784_CP_photo.jpeg" rel="nofollow noreferrer">https://dbzlpvfeeds-a.akamaihd.net/images/user_images/2018/04/29/80881784_CP_photo.jpeg</a>","geo":{"@type":"GeoCoordinates","latitude":55.3923,"longitude":25.2893}}, {"@context":"<a href="http://schema.org" rel="nofollow noreferrer">http://schema.org</a>","@type":"SingleFamilyResidence","name":"Fully Furnished  2 Bed Room Flat -Al Qusais","url":"<a href="https://dubai.dubizzle.com/property-for-rent/residential/apartmentflat/2017/10/9/fully-furnished-brand-new-2-bed-room-flat--2/" rel="nofollow noreferrer">https://dubai.dubizzle.com/property-for-rent/residential/apartmentflat/2017/10/9/fully-furnished-brand-new-2-bed-room-flat--2/</a>","address":{"@type":"PostalAddress","addressLocality":"Dubai","addressRegion":"Dubai"},"":{"@type":"Product","name":"Fully Furnished  2 Bed Room Flat -Al Qusais","url":"<a href="https://dubai.dubizzle.com/property-for-rent/residential/apartmentflat/2017/10/9/fully-furnished-brand-new-2-bed-room-flat--2/" rel="nofollow noreferrer">https://dubai.dubizzle.com/property-for-rent/residential/apartmentflat/2017/10/9/fully-furnished-brand-new-2-bed-room-flat--2/</a>","offers":{"@type":"Offer","price":70000,"priceCurrency":"AED"}},"floorSize":1400,"numberOfRooms":2,"image":"<a href="https://dbzlpvfeeds-a.akamaihd.net/images/user_images/2018/09/05/84371522_CP_photo.jpeg" rel="nofollow noreferrer">https://dbzlpvfeeds-a.akamaihd.net/images/user_images/2018/09/05/84371522_CP_photo.jpeg</a>","geo":{"@type":"GeoCoordinates","latitude":55.3959,"longitude":25.2959}}]</p>